Merge pull request #510 from Unrud/log

Improve formatting of log messages
This commit is contained in:
Guillaume Ayoub 2016-09-07 16:08:11 +02:00 committed by GitHub
commit dc94a5a4b7
2 changed files with 4 additions and 3 deletions

View File

@ -53,8 +53,8 @@ formatter = full
[formatter_simple]
# Simple output format
format = %(message)s
format = [%(thread)x] %(levelname)s: %(message)s
[formatter_full]
# Full output format
format = %(asctime)s - %(thread)d - %(levelname)s: %(message)s
format = %(asctime)s - [%(thread)x] %(levelname)s: %(message)s

View File

@ -56,7 +56,8 @@ def start(name="radicale", filename=None, debug=False):
"Logging configuration file '%s' not found, using stderr." %
filename)
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter("%(message)s"))
handler.setFormatter(
logging.Formatter("[%(thread)x] %(levelname)s: %(message)s"))
logger.addHandler(handler)
if debug:
logger.setLevel(logging.DEBUG)