commonlibs.logger package

Submodules

commonlibs.logger.logger module

Logger

commonlibs.logger.logger.decorate(string, decoration='=', n1=10, n2=None)[source]

Decorate a string to emphasise it

Args:
string:string to decorate
decoration:string used
n1:prefix multiplier
n2:suffix multiplier
Returns:
mod_string:modified string
commonlibs.logger.logger.init(log_filename, level=None)[source]

Inititalise a logger

Note:
  • A stream handler and a console handler will be added, only if there are no existing handlers
  • The logger level is determined by the attributes of ‘level’
    • Attributes can be True or False
    • Accepted levels are:
      • ‘verbose’
      • ‘debug’
      • ‘quiet’
      • Default level is waring
Args:
log_filename:Filename of the log file
level:Logger level
commonlibs.logger.logger.truncate_filepath(filepath, max_len=25, basename_only=True)[source]

Truncate a long filepath

Args:
filepath:filepath to truncate
max_len:maximum string lenght to return
basename_only:if True, only use the basename of ‘filepath’
Returns:
trunc_string:truncated filepath

Module contents