Convenience wrapper for notify with "message" */
| 1296 | |
| 1297 | /* Convenience wrapper for notify with "message" */ |
| 1298 | void plugin_notify_message(struct command *cmd, |
| 1299 | enum log_level level, |
| 1300 | const char *fmt, ...) |
| 1301 | { |
| 1302 | va_list ap; |
| 1303 | struct json_stream *js; |
| 1304 | const char *msg; |
| 1305 | |
| 1306 | va_start(ap, fmt); |
| 1307 | msg = tal_vfmt(tmpctx, fmt, ap); |
| 1308 | va_end(ap); |
| 1309 | |
| 1310 | /* Also log, debug level */ |
| 1311 | plugin_log(cmd->plugin, LOG_DBG, "notify msg %s: %s", |
| 1312 | log_level_name(level), msg); |
| 1313 | |
| 1314 | js = plugin_notify_start(cmd, "message"); |
| 1315 | json_add_string(js, "level", log_level_name(level)); |
| 1316 | |
| 1317 | /* In case we're OOM */ |
| 1318 | if (js->jout) |
| 1319 | json_out_addstr(js->jout, "message", msg); |
| 1320 | |
| 1321 | plugin_notify_end(cmd, js); |
| 1322 | } |
| 1323 | |
| 1324 | void plugin_notify_progress(struct command *cmd, |
| 1325 | u32 num_stages, u32 stage, |