From 69d3d6025ca9787dbd4285d04f1e42d78893445b Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 10 Dec 2018 16:41:42 +0100 Subject: [PATCH] pylightning: Split log messages on newlines This is just cosmetic, and makes things like tracebacks much easier to read. Signed-off-by: Christian Decker --- contrib/pylightning/lightning/plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/pylightning/lightning/plugin.py b/contrib/pylightning/lightning/plugin.py index 12d8d7227..a4c0579e4 100644 --- a/contrib/pylightning/lightning/plugin.py +++ b/contrib/pylightning/lightning/plugin.py @@ -131,7 +131,10 @@ class Plugin(object): self.stdout.flush() def log(self, message, level='info'): - self.notify('log', {'level': level, 'message': message}) + # Split the log into multiple lines and print them + # individually. Makes tracebacks much easier to read. + for line in message.split('\n'): + self.notify('log', {'level': level, 'message': line}) def _multi_dispatch(self, msgs): """We received a couple of messages, now try to dispatch them all.