Loggers are conceptually arranged in a name space hierarchy using dots (periods) as separators. For example, a logger named "scan" is the parent of loggers "scan.text", "scan.html" and "scan.pdf".

Discussion on the following is welcome:
In eXe we will have loggers mirror the module layout (unless a better classification is found). Assign the logging levels as follows:

  • DEBUG: When entering a function
  • INFO: When doing a significant operation
  • WARNING: When something is not as expected, but is not wrong
  • ERROR: When something is wrong, but the system can still recover
  • CRITICAL: Upon a catostrophic error which causes the system to exit/crash.

Example {{{ import logging

log = logging.getLogger(name)

# =========================================================================== class Package:

""" Package represents the collection of resources the user is editing i.e. the "package". """ def init(self, name):

log.debug("init", name)"About to do something interesting") log.warning("Something went wrong, but no big deal") log.error("Ooops, something serious went wrong") log.critical("The program is about to CRASH!!!!!")


logging.config.fileConfig() is unweildy, errorprone, and doesn't do what I want (set level on root and only override where needed on children)

Discussion on Python logging here.

Last modified 10 years ago Last modified on 2009-05-22T06:10:58+09:00