Logger¶
-
class
Logger(name='', parent=None, format=None)[source]¶ Bases:
taurus.core.util.object.ObjectThe taurus logger class. All taurus pertinent classes should inherit directly or indirectly from this class if they need taurus logging facilities.
-
Critical= 50¶ Critical message level (constant)
-
Debug= 10¶ Debug message level (constant)
-
DftLogFormat= <logging.Formatter object>¶ Default log format (constant)
-
DftLogLevel= 20¶ Default log level (constant)
-
DftLogMessageFormat= '%(threadName)-14s %(levelname)-8s %(asctime)s %(name)s: %(message)s'¶ Default log message format (constant)
-
Error= 40¶ Error message level (constant)
-
Fatal= 50¶ Fatal message level (constant)
-
Info= 20¶ Info message level (constant)
-
Trace= 5¶ Trace message level (constant)
-
Warning= 30¶ Warning message level (constant)
-
addChild(child)[source]¶ Adds a new logging child
Parameters: child (:class:~`logging.Logger`) – the new child
-
classmethod
addLevelName(level_no, level_name)[source]¶ Registers a new log level
Parameters: - level_no (:class:~`int`) – the level number
- level_name (:class:~`str`) – the corresponding name
-
addLogHandler(handler)[source]¶ Registers a new handler in this object’s logger
Parameters: handler (:class:~`logging.Handler`) – the new handler to be added
-
classmethod
addRootLogHandler(h)[source]¶ Adds a new handler to the root logger
Parameters: h (:class:~`logging.Handler`) – the new log handler
-
changeLogName(name)[source]¶ Change the log name for this object.
Parameters: name (:class:~`str`) – the new log name
-
copyLogHandlers(other)[source]¶ Copies the log handlers of other object to this object
Parameters: other (:class:~`object`) – object which contains ‘log_handlers’
-
critical(msg, *args, **kw)[source]¶ Record a critical message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.critical().Parameters: - msg (:class:~`str`) – the message to be recorded
- args – list of arguments
- kw – list of keyword arguments
-
debug(msg, *args, **kw)[source]¶ Record a debug message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.debug().Parameters: - msg (:class:~`str`) – the message to be recorded
- args – list of arguments
- kw – list of keyword arguments
-
deprecated(msg, *args, **kw)[source]¶ Record a deprecated warning message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.warning().Parameters: - msg (:class:~`str`) – the message to be recorded
- args – list of arguments
- kw – list of keyword arguments
-
classmethod
disableLogOutput()[source]¶ Disables the
logging.StreamHandlerwhich dumps log records, by default, to the stderr.
-
classmethod
enableLogOutput()[source]¶ Enables the
logging.StreamHandlerwhich dumps log records, by default, to the stderr.
-
error(msg, *args, **kw)[source]¶ Record an error message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.error().Parameters: - msg (:class:~`str`) – the message to be recorded
- args – list of arguments
- kw – list of keyword arguments
-
exception(msg, *args)[source]¶ Log a message with severity ‘ERROR’ on the root logger, with exception information.. Accepted args are the same as
logging.Logger.exception().Parameters: - msg (:class:~`str`) – the message to be recorded
- args – list of arguments
-
fatal(msg, *args, **kw)[source]¶ Record a fatal message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.fatal().Parameters: - msg (:class:~`str`) – the message to be recorded
- args – list of arguments
- kw – list of keyword arguments
-
getChildren()[source]¶ Returns the log children for this object
Return type: :class:~`sequence<logging.Logger` Returns: the list of log children
-
classmethod
getLogFormat()[source]¶ Retuns the current log message format (the root log format)
Return type: :class:~`str` Returns: the log message format
-
getLogFullName()[source]¶ Gets the full log name for this object
Return type: :class:~`str` Returns: the full log name
-
classmethod
getLogLevel()[source]¶ Retuns the current log level (the root log level)
Return type: :class:~`int` Returns: a number representing the log level
-
getLogName()[source]¶ Gets the log name for this object
Return type: :class:~`str` Returns: the log name
-
getLogObj()[source]¶ Returns the log object for this object
Return type: :class:~`logging.Logger` Returns: the log object
-
getParent()[source]¶ Returns the log parent for this object or None if no parent exists
Return type: :class:~`logging.Logger` or :class:~`None` Returns: the log parent for this object
-
classmethod
getRootLog()[source]¶ Retuns the root logger
Return type: :class:~`logging.Logger` Returns: the root logger
-
info(msg, *args, **kw)[source]¶ Record an info message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.info().Parameters: - msg (:class:~`str`) – the message to be recorded
- args – list of arguments
- kw – list of keyword arguments
-
classmethod
initRoot()[source]¶ Class method to initialize the root logger. Do NOT call this method directly in your code
-
log(level, msg, *args, **kw)[source]¶ Record a log message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.log().Parameters: - level (:class:~`int`) – the record level
- msg (:class:~`str`) – the message to be recorded
- args – list of arguments
- kw – list of keyword arguments
-
log_format= <logging.Formatter object>¶ Default log message format
-
log_level= 20¶ Current global log level
-
classmethod
removeRootLogHandler(h)[source]¶ Removes the given handler from the root logger
Parameters: h (:class:~`logging.Handler`) – the handler to be removed
-
root_init_lock= <thread.lock object>¶ Internal usage
-
root_inited= True¶ Internal usage
-
classmethod
setLogFormat(format)[source]¶ sets the new log message format
Parameters: level (:class:~`str`) – the new log message format
-
classmethod
setLogLevel(level)[source]¶ sets the new log level (the root log level)
Parameters: level (:class:~`int`) – the new log level
-
stack(target=5)[source]¶ Log the usual stack information, followed by a listing of all the local variables in each frame.
Parameters: target (:class:~`int`) – the log level assigned to the record Return type: :class:~`str` Returns: The stack string representation
-
stream_handler= <logging.StreamHandler object>¶ the main stream handler
-
trace(msg, *args, **kw)[source]¶ Record a trace message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.log().Parameters: - msg (:class:~`str`) – the message to be recorded
- args – list of arguments
- kw – list of keyword arguments
-
traceback(level=5, extended=True)[source]¶ Log the usual traceback information, followed by a listing of all the local variables in each frame.
Parameters: - level (:class:~`int`) – the log level assigned to the traceback record
- extended (:class:~`bool`) – if True, the log record message will have multiple lines
Return type: :class:~`str`
Returns: The traceback string representation
-