Commit 27b2c0c2 authored by Vincent Pelletier's avatar Vincent Pelletier

Stop using basicConfig.

There are 2 reasons:
- don't mess with default logger, NEO is not an application but a module
- basicConfig only works once, and we might want to override a previous
  setup

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2369 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6b7b416d
...@@ -30,6 +30,14 @@ def setupLog(name='NEO', filename=None, verbose=False): ...@@ -30,6 +30,14 @@ def setupLog(name='NEO', filename=None, verbose=False):
else: else:
level = logging_std.INFO level = logging_std.INFO
fmt = PREFIX + SUFFIX fmt = PREFIX + SUFFIX
logging_std.basicConfig(filename=filename, level=level, format=fmt)
logging = logging_std.getLogger(name.upper()) logging = logging_std.getLogger(name.upper())
for handler in logging.handlers:
logging.removeHandler(handler)
if filename is None:
handler = logging_std.StreamHandler()
else:
handler = logging_std.FileHandler(filename)
handler.setFormatter(logging_std.Formatter(fmt))
handler.setLevel(level)
logging.addHandler(handler)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment