Project/Multiple Class Verbose Mode Python
Question: I'm wondering what the simplest way to enable debugging/verbose mode outputs
in a project that involves multiple classes/files. The answer given here:
[Easier way to enable verbose
logging](http://stackoverflow.com/questions/14097061/easier-way-to-enable-
verbose-logging) works well in a single script but what might be the best
implementation across multiple classes?

I've thought to use the Singleton design pattern to set a single instance of a
`"Debugger"` which will have a `Debugger.log("message")`. Is there a better
way to accomplish this?


Answer: This already exists. this is `logging.root` which is a `logging.Logger`
instance. You just need to set it up before using it. A simple example:

    
    
    >>> import logging
    >>>
    >>> logging.root.setLevel('INFO')
    >>> logging.root.info('Info message')
    INFO:root:Info message
    

The logging functions for the root logger are also available from the
`logging` module directly:

    
    
    >>> logging.info('Info message')
    INFO:root:Info message
    

For a full reference on how to setup a logger see [the official python
documentation](http://docs.python.org/3.3/library/logging.html).

