12 LOG_LEVEL_DEBUG: 'DEBUG', \
13 LOG_LEVEL_INFO: 'INFO', \
14 LOG_LEVEL_WARNING: 'WARNING', \
15 LOG_LEVEL_ERROR: 'ERROR', \
16 LOG_LEVEL_FATAL: 'FATAL', \
21 def log_msg(msg, level=LOG_LEVEL_INFO):
23 Prints log messages based on the log level.
26 if level == LOG_LEVEL_ALL or level == LOG_LEVEL_OFF:
29 if level < config.LOG_LEVEL:
32 if level >= LOG_LEVEL_ERROR:
37 f.write('[%s] %s\n' % (LOG_LEVEL_NAMES[level], msg))