FileBackend

FileBackend wrapper

class DIRAC.Resources.LogBackends.FileBackend.FileBackend(backendParams=None, backendFilters=None)

Bases: AbstractBackend

FileBackend is used to create an abstraction of the handler and the formatter concepts from logging. Here, we gather a FileHandler object and a BaseFormatter.

  • FileHandler is from the standard logging library: it is used to write log messages in a desired file so it needs a filename.

  • BaseFormatter is a custom Formatter object, created for DIRAC in order to get the appropriate display. You can find it in FrameworkSystem/private/standardLogging/Formatter

__init__(backendParams=None, backendFilters=None)

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.

Parameters:
  • 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

getHandler()
Returns:

the handler

setLevel(levelName)

Configure the level of the handler associated to the backend. Make sure the handler has been created before calling the method.

Parameters:

level (int) – a level