- class DIRAC.Resources.LogBackends.AbstractBackend.AbstractBackend(handlerType, formatterType, backendParams=None, backendFilters=None, level='debug')
AbstractBackend is used to create an abstraction of handler and formatter concepts from ‘logging’. It corresponds to the backend concept of the old gLogger. It is useful for different reasons:
to gather handler and formatter, in DIRAC, each handler must be bind with a specific formatter so it is more simple and more clear to create an object for this job.
each backend can get its options and format them to give them to the handler, in DIRAC, it is possible to add backend options in the cfgfile. For example, for a file, you can give the filename that you want to write log inside. The backend allows to each handler to get its own options as parameters. Again, it is more clear and more simple to have a specific object for this job.
In this way, we have an object composed by one handler and one formatter name. The purpose of the object is to get cfg options to give them to the handler, and to set the format of the handler when the display must be changed.
- __init__(handlerType, formatterType, backendParams=None, backendFilters=None, level='debug')
Initialization of the backend. _handler and _formatter can be custom objects. If it is the case, you can find them in FrameworkSystem/private/standardLogging/Formatter or Handler.
handlerType – handler object from ‘logging’. Ex: StreamHandler(), FileHandler()…
formatterType – the name of a formatter object from logging. Ex: BaseFormatter
backendParams (dict) – parameters to set up the backend
backendFilters (list) – list of different instances of ‘logging.Filter’.
level (str) – level of the handler