From 6c04ee3ea292fc0f2e21951f181d308691ba4487 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Mon, 3 Jun 2019 10:18:49 +0200 Subject: [PATCH] logger: replace newline in messages with simple space --- oletools/common/log_helper/_json_formatter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oletools/common/log_helper/_json_formatter.py b/oletools/common/log_helper/_json_formatter.py index 6adc55c..1f334a8 100644 --- a/oletools/common/log_helper/_json_formatter.py +++ b/oletools/common/log_helper/_json_formatter.py @@ -18,7 +18,7 @@ class JsonFormatter(logging.Formatter): ensures that there is a `type` field in the record. Otherwise will have to add a try-except around the access to `record.type`. """ - json_dict = dict(msg=record.msg, level=record.levelname) + json_dict = dict(msg=record.msg.replace('\n', ' '), level=record.levelname) json_dict['type'] = record.type formatted_message = ' ' + json.dumps(json_dict) -- libgit2 0.21.4