Package jazzparser :: Package utils :: Module loggers
[hide private]
[frames] | no frames]

Module loggers

source code

Initialization of the logging system.

An application that calls methods that use logging should first call init_logging, or else the logging messages will all get lost.


Author: Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>

Classes [hide private]
  NullHandler
A handler that drops all the logs.
Functions [hide private]
 
init_logging(log_level=None)
Set up a logger to output test/error messages
source code
 
create_logger(log_level=None, name=None, stdout=False, filename=None, stderr=False)
Set up a logger to log to a file.
source code
 
create_dummy_logger()
Creates a new logger that won't ever output anything.
source code
 
create_plain_stderr_logger(log_level=None, stdout=False)
Creates a new logging that just outputs the messages to stderr, with no extra logging information.
source code
Variables [hide private]
  _logger_id = 0
  __package__ = 'jazzparser.utils'
Function Details [hide private]

create_logger(log_level=None, name=None, stdout=False, filename=None, stderr=False)

source code 

Set up a logger to log to a file.

Parameters:
  • filename (string) - the file to write the logs to. If None, doesn't add a handler for file output.
  • log_level - one of the level constants in logging; the log level to give the logger. Defaults to INFO.
  • name (string) - name to give to the logger. By default, uses the filename. If neither is given, raises an exception.
  • stdout (bool) - if True, also adds a handler to output to stdout
Returns:
the Logger instance created

create_plain_stderr_logger(log_level=None, stdout=False)

source code 

Creates a new logging that just outputs the messages to stderr, with no extra logging information. The log level will be set to debug by default, so logging anything to this logger is just the same as writing to stderr.

If you call this more than once, a different logger will be returned.

Parameters:
  • stdout (bool) - if True, uses stdout instead of stderr