From 8c2d73f112055a9e52e5bda4934c2ac90e31def7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 18 Nov 2019 00:44:12 +0100 Subject: player: remove mechanisms for better logging with repl.lua As preparation for making repl.lua part of the core (maybe), add some mechanisms which are supposed to improve its behavior. Add a silent mode. Calling mpv_request_log_messages() with the log level name prefixed with "silent:" will disable logging from the API user's perspective. But it will keep the log buffer, and record new messages, without returning them to the user. If logging is enabled again by requesting the same log level without "silent:" prefix, the buffered log messages are returned to the user at once. This is not documented, because it's far too messy and special as that I'd want anyone to rely on this behavior, but it will be perfectly fine for an internal script. Another thing is that we record early startup messages. The goal is to make the repl.lua script show option and config parsing file errors. This works only with the special "terminal-default" log level. In addition, reduce the "terminal-default" capacity to only 100 log messages. If this is going to be enabled by default, it shouldn't use too much resources. --- player/loadfile.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'player/loadfile.c') diff --git a/player/loadfile.c b/player/loadfile.c index 09b7167f60..9d515b2012 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -35,6 +35,7 @@ #include "client.h" #include "common/msg.h" +#include "common/msg_control.h" #include "common/global.h" #include "options/path.h" #include "options/m_config.h" @@ -1766,6 +1767,8 @@ void mp_play_files(struct MPContext *mpctx) mp_wakeup_core(mpctx); // avoid lost wakeups during waiting MP_VERBOSE(mpctx, "Done loading scripts.\n"); } + // After above is finished; but even if it's skipped. + mp_msg_set_early_logging(mpctx->global, false); prepare_playlist(mpctx, mpctx->playlist); -- cgit v1.2.3