stdout output should just be WARN - put INFO in to a daily file
this is because stdout, in something like systemd, will mess up journalctl output.
This commit is contained in:
parent
84ec6d812f
commit
f721cf848a
1 changed files with 8 additions and 1 deletions
|
@ -29,7 +29,7 @@ class Log(object):
|
||||||
formatter = BitBotFormatter("%(asctime)s [%(levelname)s] %(message)s")
|
formatter = BitBotFormatter("%(asctime)s [%(levelname)s] %(message)s")
|
||||||
|
|
||||||
stdout_handler = logging.StreamHandler(sys.stdout)
|
stdout_handler = logging.StreamHandler(sys.stdout)
|
||||||
stdout_handler.setLevel(stdout_level)
|
stdout_handler.setLevel(LEVELS["warn"])
|
||||||
stdout_handler.setFormatter(formatter)
|
stdout_handler.setFormatter(formatter)
|
||||||
self.logger.addHandler(stdout_handler)
|
self.logger.addHandler(stdout_handler)
|
||||||
|
|
||||||
|
@ -41,6 +41,13 @@ class Log(object):
|
||||||
trace_handler.setFormatter(formatter)
|
trace_handler.setFormatter(formatter)
|
||||||
self.logger.addHandler(trace_handler)
|
self.logger.addHandler(trace_handler)
|
||||||
|
|
||||||
|
info_path = os.path.join(location, "info.log")
|
||||||
|
info_handler = logging.handlers.TimedRotatingFileHandler(
|
||||||
|
info_path, when="midnight", backupCount=0)
|
||||||
|
info_handler.setLevel(LEVELS["info"])
|
||||||
|
info_handler.setFormatter(formatter)
|
||||||
|
self.logger.addHandler(info_handler)
|
||||||
|
|
||||||
warn_path = os.path.join(location, "warn.log")
|
warn_path = os.path.join(location, "warn.log")
|
||||||
warn_handler = logging.FileHandler(warn_path)
|
warn_handler = logging.FileHandler(warn_path)
|
||||||
warn_handler.setLevel(LEVELS["warn"])
|
warn_handler.setLevel(LEVELS["warn"])
|
||||||
|
|
Loading…
Reference in a new issue