ServerBackend

ServerBackend wrapper

class DIRAC.Resources.LogBackends.ServerBackend.ServerBackend

Bases: DIRAC.Resources.LogBackends.AbstractBackend.AbstractBackend

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

  • ServerHandler is a custom handler object, created for DIRAC because it has no equivalent: it is used to write log messages in a server DIRAC service: SystemLogging from FrameworkSystem. You can find it in FrameworkSystem/private/standardLogging/Handler
  • 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__()
Params __site:string representing the site where the log messages are from.
Params __interactive:
 not used at the moment.
Params __sleepTime:
 the time separating the log messages sending, in seconds.
static createFormat(options)

Create a format from the options given in parameters.

Params options:dictionary of options of the Logging which wants a new format
Params level:integer representing the level of the Logging object which wants a new format
Returns:tuple containing two strings: a format and a date format
createHandler(parameters=None)

Each backend can initialize its attributes and create its handler with them.

Params parameters:
 dictionary of parameters. ex: {‘FileName’: file.log}
getHandler()
Returns:the handler
setFormat(fmt, datefmt, options)

Each backend give a format to their formatters and attach them to their handlers.

Params fmt:string representing the log format
Params datefmt:string representing the date format
Params component:
 string represented as “system/component”
Params options:dictionary of logging options. ex: {‘Color’: True}
setLevel(level)

No possibility to set the level of the server backend because it is hardcoded to ERROR and must not be changed