Convenience wrapper for notify with "message" */
| 1931 | |
| 1932 | /* Convenience wrapper for notify with "message" */ |
| 1933 | void plugin_notify_message(struct command *cmd, |
| 1934 | enum log_level level, |
| 1935 | const char *fmt, ...) |
| 1936 | { |
| 1937 | va_list ap; |
| 1938 | struct json_stream *js; |
| 1939 | const char *msg; |
| 1940 | |
| 1941 | va_start(ap, fmt); |
| 1942 | msg = tal_vfmt(tmpctx, fmt, ap); |
| 1943 | va_end(ap); |
| 1944 | |
| 1945 | /* Also log, debug level */ |
| 1946 | plugin_log(cmd->plugin, LOG_DBG, "notify msg %s: %s", |
| 1947 | log_level_name(level), msg); |
| 1948 | |
| 1949 | js = plugin_notify_start(cmd, "message"); |
| 1950 | json_add_string(js, "level", log_level_name(level)); |
| 1951 | |
| 1952 | /* In case we're OOM */ |
| 1953 | if (js->jout) |
| 1954 | json_out_addstr(js->jout, "message", msg); |
| 1955 | |
| 1956 | plugin_notify_end(cmd, js); |
| 1957 | } |
| 1958 | |
| 1959 | void plugin_notify_progress(struct command *cmd, |
| 1960 | u32 num_stages, u32 stage, |