summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRafael Lisboa <rafaelzlisboa@gmail.com>2015-02-27 18:22:18 -0300
committerPixpoa pairing <pixpoapairing@pixelated-project.org>2015-02-27 18:23:11 -0300
commitd2b0cedd800d7110bab39afdf2ea721acd9a0a6e (patch)
tree33af97318735e4d98abd16bef324b1e00eb6cfc0 /service
parent3576c77fa8b1cd2759f4257fc25b4461b024906d (diff)
#74 use basic config for default logging
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/config/logging_setup.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/service/pixelated/config/logging_setup.py b/service/pixelated/config/logging_setup.py
index f42f91c9..443d7d82 100644
--- a/service/pixelated/config/logging_setup.py
+++ b/service/pixelated/config/logging_setup.py
@@ -26,26 +26,21 @@ LOG_FILE = '/tmp/pixelated.log'
def init_logging(args):
- pixelated_log_format = '[%(asctime)s] ' + socket.gethostname() + ' %(name)-12s %(levelname)-8s %(message)s'
- pixelated_log = logging.FileHandler(LOG_FILE)
- pixelated_log.setLevel(logging.DEBUG)
- pixelated_log.setFormatter(logging.Formatter(pixelated_log_format))
-
- logging.getLogger('').addHandler(pixelated_log)
- init_twisted_logging()
debug_enabled = args.debug or os.environ.get('DEBUG', False)
+ logging.basicConfig(level=logging.DEBUG if debug_enabled else logging.WARNING,
+ format='[%(asctime)s] ' + socket.gethostname() + ' %(name)-12s %(levelname)-8s %(message)s',
+ datefmt='%m-%d %H:%M:%S',
+ filename=LOG_FILE,
+ filemode='a')
+
if debug_enabled:
init_debugger()
+ init_twisted_logging()
-def init_debugger():
- logging.basicConfig(level=logging.DEBUG,
- format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
- datefmt='%m-%d %H:%M:%S',
- filename='/tmp/leap.log',
- filemode='w') # define a Handler which writes INFO messages or higher to the sys.stderr
+def init_debugger():
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)