diff --git a/lightningd/plugin.c b/lightningd/plugin.c index cad0c80ac472..a83c7f91a8f6 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -516,12 +516,8 @@ static const char *plugin_log_handle(struct plugin *plugin, lines = tal_strsplit(tmpctx, log_msg, "\n", STR_EMPTY_OK); for (size_t i = 0; lines[i]; i++) { - bool call_notifier2 = call_notifier; - /* Call notifier only for the last message to avoid Python errors. */ - if (lines[i+1] != NULL) - call_notifier2 = false; /* FIXME: Let plugin specify node_id? */ - log_(plugin->log, level, NULL, call_notifier2, "%s", lines[i]); + log_(plugin->log, level, NULL, call_notifier, "%s", lines[i]); } } else { log_(plugin->log, level, NULL, call_notifier, "%.*s", diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 254cb956286d..f1ecc3d25e86 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1256,7 +1256,7 @@ def test_htlc_accepted_hook_forward_restart(node_factory, executor): def test_warning_notification(node_factory): """ test 'warning' notifications """ - l1 = node_factory.get_node(options={'plugin': os.path.join(os.getcwd(), 'tests/plugins/pretend_badlog.py')}, broken_log=r'Test warning notification\(for broken event\)') + l1 = node_factory.get_node(options={'plugin': os.path.join(os.getcwd(), 'tests/plugins/pretend_badlog.py')}, broken_log=r'Test warning notification\(for broken event\)|LINE[12]') # 1. test 'warn' level event = "Test warning notification(for unusual event)" @@ -1283,6 +1283,15 @@ def test_warning_notification(node_factory): l1.daemon.wait_for_log('plugin-pretend_badlog.py: source: plugin-pretend_badlog.py') l1.daemon.wait_for_log('plugin-pretend_badlog.py: log: Test warning notification\\(for broken event\\)') + # Test linesplitting while we're here + l1.rpc.call('pretendbad', {'event': 'LINE1\nLINE2', 'level': 'error'}) + l1.daemon.wait_for_log(r'\*\*BROKEN\*\* plugin-pretend_badlog.py: LINE1') + l1.daemon.wait_for_log(r'\*\*BROKEN\*\* plugin-pretend_badlog.py: LINE2') + l1.daemon.wait_for_log('plugin-pretend_badlog.py: Received warning') + l1.daemon.wait_for_log('plugin-pretend_badlog.py: log: LINE1') + l1.daemon.wait_for_log('plugin-pretend_badlog.py: Received warning') + l1.daemon.wait_for_log('plugin-pretend_badlog.py: log: LINE2') + def test_invoice_payment_notification(node_factory): """