Package commons :: Module log
[hide private]
[frames] | no frames]

Module log

source code

Convenience functions for the standard logging library.

Functions are mostly self-explanatory.

Functions [hide private]
 
fmt(flag, *args) source code
 
log(level, flag, *args) source code
 
exception(flag, *args) source code
 
critical(flag, *args) source code
 
error(flag, *args) source code
 
warning(flag, *args) source code
 
debug(flag, *args) source code
 
info(flag, *args) source code
 
die(flag, *args) source code
 
tailor_logs(flag, *prefix)
Avoid repetitive typing! Usage:
source code
 
config_logging(level=20, do_console=False, do_file=False, do_server=False, flags=[], path=None, log_format='%(asctime)s %(levelname)-8s %(message)s', log_date_format=None)
Configures logging, promoting some common configurations.
source code
Variables [hide private]
  unittest
  cp1252_to_unicode_translations = [(u'', u''), (u'', u''), ...
  unicode_special = re.compile(r'[\x80-\uffff]')
  re
  cgi
  quotejs
  unindent
  itertools
  str_test
  __package__ = 'commons'
Function Details [hide private]

tailor_logs(flag, *prefix)

source code 

Avoid repetitive typing! Usage:

 debug,info,warning,_,_ = tailor_logs('myflag','some','prefix')

config_logging(level=20, do_console=False, do_file=False, do_server=False, flags=[], path=None, log_format='%(asctime)s %(levelname)-8s %(message)s', log_date_format=None)

source code 

Configures logging, promoting some common configurations.

Parameters:
  • level (int) - The default log-level threshold for all loggers. (Note that this is not the level for all handlers.)
  • do_console (bool) - Whether to enable the console handler.
  • do_file (bool) - Whether to enable the file handler.
  • do_server (bool) - Whether to enable a network socket stream handler.
  • flags (iterable) - The set of flags on which to lower the threshold to logging.DEBUG.
  • path (str) - The path of the log file (only considered if do_file is True.
  • log_format (str) - The log message formatting template.
  • log_date_format (str) - The timestamp formatting template.

Variables Details [hide private]

cp1252_to_unicode_translations

Value:
[(u'', u''),
 (u'', u''),
 (u'ƒ', u'ƒ'),
 (u'', u''),
 (u'', u''),
 (u'', u''),
 (u'', u''),
 (u'ˆ', u'ˆ'),
...