logging.Logger

class logging.Logger

logging.log()

logging.log(level, msg, *args, **kwargs) Logs a message with level level on the root logger. The other arguments are interpreted as for debug(). Note The above module-level convenience functions, which delegate to the root logger, call basicConfig() to ensure that at least one handler is available. Because of this, they should not be used in threads, in versions of Python earlier than 2.7.1 and 3.2, unless at least one handler has been added to the root logger before the threads are started

logging.lastResort

logging.lastResort A “handler of last resort” is available through this attribute. This is a StreamHandler writing to sys.stderr with a level of WARNING, and is used to handle logging events in the absence of any logging configuration. The end result is to just print the message to sys.stderr. This replaces the earlier error message saying that “no handlers could be found for logger XYZ”. If you need the earlier behaviour for some reason, lastResort can be set to None. New in version 3.2.

logging.info()

logging.info(msg, *args, **kwargs) Logs a message with level INFO on the root logger. The arguments are interpreted as for debug().

logging.handlers.WatchedFileHandler.emit()

emit(record) Outputs the record to the file, but first checks to see if the file has changed. If it has, the existing stream is flushed and closed and the file opened again, before outputting the record to the file.

logging.handlers.WatchedFileHandler

class logging.handlers.WatchedFileHandler(filename, mode='a', encoding=None, delay=False) Returns a new instance of the WatchedFileHandler class. The specified file is opened and used as the stream for logging. If mode is not specified, 'a' is used. If encoding is not None, it is used to open the file with that encoding. If delay is true, then file opening is deferred until the first call to emit(). By default, the file grows indefinitely. emit(record) Outputs the record to the file, but

logging.handlers.TimedRotatingFileHandler.emit()

emit(record) Outputs the record to the file, catering for rollover as described above.

logging.handlers.TimedRotatingFileHandler.doRollover()

doRollover() Does a rollover, as described above.

logging.handlers.TimedRotatingFileHandler

class logging.handlers.TimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None) Returns a new instance of the TimedRotatingFileHandler class. The specified file is opened and used as the stream for logging. On rotating it also sets the filename suffix. Rotating happens based on the product of when and interval. You can use the when to specify the type of interval. The list of possible values is below. Note that they are not c

logging.handlers.SysLogHandler.mapPriority()

mapPriority(levelname) Maps a logging level name to a syslog priority name. You may need to override this if you are using custom levels, or if the default algorithm is not suitable for your needs. The default algorithm maps DEBUG, INFO, WARNING, ERROR and CRITICAL to the equivalent syslog names, and all other level names to ‘warning’.