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