OPSI.Logger module

opsi python library - Logger

copyright:uib GmbH <info@uib.de>
author:Jan Schneider <j.schneider@uib.de>
author:Niko Wenselowski <n.wenselowski@uib.de>
license:GNU Affero General Public License version 3
class OPSI.Logger.Logger(logFile=None)

Bases: OPSI.Logger.LoggerImplementation

This class implements a SINGLETON used for logging to console, file or syslog.

class OPSI.Logger.LoggerImplementation(logFile=None)

Implementation of the singleton interface

addConfidentialString(string)
comment(message, *args, **kwargs)

Log a comment message.

confidential(message, *args, **kwargs)

Log a confidential message.

critical(message, *args, **kwargs)

Log a critical message.

debug(message, *args, **kwargs)

Log a debug message.

debug2(message, *args, **kwargs)

Log a debug message.

debug3(message, *args, **kwargs)

Log a debug message.

err(message)

Log a error message.

error(message, *args, **kwargs)

Log a error message.

essential(message, *args, **kwargs)

Log a essential message.

exit(object=None)
getConsoleLevel()
getFileLevel()
getLogFile(currentThread=False, object=None)
getMessageSubject()
getStderr()
getStdout()
info(message, *args, **kwargs)

Log a info message.

linkLogFile(linkFile, currentThread=False, object=None)

Link the current logfile to linkfile.

log(level, message, raiseException=False, formatArgs=[], formatKwargs={})

Log a message with the given level.

Parameters:
  • level – The log level of this message.
  • message – The message to log.
  • raiseException (bool) – True raises an exception if any error occurs. False suppresses exceptions.
logException(e, logLevel=2)
logFailure(failure, logLevel=2)
logToStdout(stdout)
logTraceback(tb, logLevel=2)

Log an traceback.

This will log the call trace from the given traceback.

logWarnings()

Use OPSI.Logger to log warning messages.

This redirects messages emitted to the warnings modules to the opsi logger.

msg(message, *args, **kwargs)

Log a info message.

notice(message, *args, **kwargs)

Log a notice message.

setColor(color)

Enable or disable ansi color output

setComponentName(componentName, currentThread=False, object=None)
setConfidentialStrings(strings)
setConsoleColor(color)

Enable or disable ansi color output

setConsoleFormat(format, currentThread=False, object=None)
setConsoleLevel(level=0)

Maximum level of messages to print to stderr Set LOG_NONE to disable output to stderr (default)

setFileColor(color)

Enable or disable ansi color output

setFileFormat(format, currentThread=False, object=None)
setFileLevel(level=0)

Maximum level of messages to appear in logfile Set LOG_NONE to disable output to logfile (default)

setLogFile(logFile, currentThread=False, object=None)

Set the filename of logfile.

Parameters:logFile – The path to the logfile. Setting this to None will disable logging to a file.
setLogFormat(format, currentThread=False, object=None)
setMessageSubjectFormat(format, currentThread=False, object=None)
setMessageSubjectLevel(level=0)
setSyslogFormat(format, currentThread=False, object=None)
setSyslogLevel(level=0)

Maximum level of messages to log by syslog. Set LOG_NONE to disable syslog (default)

setUniventionClass(c)
setUniventionFormat(format, currentThread=False, object=None)
setUniventionLogger(logger)
startTwistedLogging()
warning(message, *args, **kwargs)

Log a warning message.

class OPSI.Logger.LoggerSubject
attachObserver(observer)
detachObserver(observer)
getClass()
getId()
getMessage()
getSeverity()
getType()
serializable()
setMessage(message, severity=0)
class OPSI.Logger.TwistedLogObserver(logger)

Bases: object

emit(eventDict)
class OPSI.Logger.VirtFile(logger, level)

Bases: object

flush()
write(s)
OPSI.Logger.forceUnicode(var)