Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Log levels as string does not work on Python 2.6.x

I thought that was new. Turns out it just disables logging if you use a
string as well so that was lovely to figure out.
  • Loading branch information...
commit b78047f604fbfa681bbb50e2bbcb6390332f105e 1 parent d3949b9
@davisp davisp authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 bucky/main.py
View
11 bucky/main.py
@@ -167,6 +167,13 @@ def load_config(cfgfile, full_trace=False):
def configure_logging():
+ levels = {
+ 'debug': logging.DEBUG,
+ 'info': logging.INFO,
+ 'warning': logging.WARNING,
+ 'error': logging.ERROR,
+ 'critical': logging.CRITICAL
+ }
logfmt = "[%(levelname)s] %(module)s - %(message)s"
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter(logfmt))
@@ -174,8 +181,8 @@ def configure_logging():
logging.root.addHandler(handler)
logging.root.setLevel(logging.DEBUG)
if cfg.debug:
- cfg.log_level = "DEBUG"
- handler.setLevel(cfg.log_level)
+ cfg.log_level = "debug"
+ handler.setLevel(levels.get(cfg.log_level.lower(), logging.INFO))
if __name__ == '__main__':
Please sign in to comment.
Something went wrong with that request. Please try again.