pylightning: Split log messages on newlines

This is just cosmetic, and makes things like tracebacks much easier to
read.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2018-12-10 16:41:42 +01:00
parent 643480cfd8
commit 1eb23d6b29

View File

@ -131,7 +131,10 @@ class Plugin(object):
self.stdout.flush() self.stdout.flush()
def log(self, message, level='info'): 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): def _multi_dispatch(self, msgs):
"""We received a couple of messages, now try to dispatch them all. """We received a couple of messages, now try to dispatch them all.