module documentation
Utility functions for logging.
| Function | |
Configures the logging module. |
| Function | |
Configures the logging module for tools. |
| Class | _ |
Log handler with ability to reopen log file on request. |
| Function | _ |
Build log formatter. |
| Function | _ |
Create wrapper class writing errors to console. |
| Function | _ |
Wrapper for reopening all log handler's files in a sequence. |
| Variable | _ |
Undocumented |
def SetupLogging(logfile, program, debug=0, stderr_logging=False, multithreaded=False, syslog=constants.SYSLOG_USAGE, console_logging=False, root_logger=None):
¶
Configures the logging module.
| Parameters | |
| logfile:str | the filename to which we should log |
| program:str | the name under which we should log messages |
| debug:integer | if greater than zero, enable debug messages, otherwise only those at INFO and above level |
| stderr | whether we should also log to the standard error |
| multithreaded:boolean | if True, will add the thread name to the log file |
| syslog:string | one of 'no', 'yes', 'only':
|
| console | if True, will use a FileHandler which falls back to the system console if logging fails |
| root | Root logger to use (for unittests) |
| Returns | |
| callable | Function reopening all open log files when called |
| Raises | |
EnvironmentError | if we can't open the log file and syslog/stderr logging is disabled |
Configures the logging module for tools.
All log messages are sent to stderr.
| Parameters | |
| debug:boolean | Disable log message filtering |
| verbose:boolean | Enable verbose log messages |
| threadname:boolean | Whether to include thread name in output |
| _root | Undocumented |
| _stream | Undocumented |
Build log formatter.
| Parameters | |
| program | Program name |
| multithreaded | Whether to add thread name to log messages |
| debug | Whether to enable debug messages |
| syslog | Whether the formatter will be used for syslog |