Browse Source

Refactor logging setup so it works when disabled.

tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
004dd0b51e
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      earwigbot/config.py

+ 2
- 3
earwigbot/config.py View File

@@ -123,12 +123,11 @@ class BotConfig(object):
logger = logging.getLogger("earwigbot") logger = logging.getLogger("earwigbot")
logger.handlers = [] # Remove any handlers already attached to us logger.handlers = [] # Remove any handlers already attached to us
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
color_formatter = _BotFormatter(color=True)
formatter = _BotFormatter()


if self.metadata.get("enableLogging"): if self.metadata.get("enableLogging"):
hand = logging.handlers.TimedRotatingFileHandler hand = logging.handlers.TimedRotatingFileHandler
formatter = _BotFormatter()
color_formatter = _BotFormatter(color=True)

logfile = lambda f: path.join(log_dir, f) logfile = lambda f: path.join(log_dir, f)


if not path.isdir(log_dir): if not path.isdir(log_dir):


Loading…
Cancel
Save