diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2022-12-15 18:09:03 +0200 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2023-01-23 11:05:08 +0200 |
commit | 8eb7a00fa1f091e1766997f3d972d6c5fe9ac018 (patch) | |
tree | ac8596fb36128b0fb6f449403925ac54949d9004 /player/main.c | |
parent | 17baa00e028367898c5a91127d71c3a3487b427a (diff) | |
download | mpv-8eb7a00fa1f091e1766997f3d972d6c5fe9ac018.tar.bz2 mpv-8eb7a00fa1f091e1766997f3d972d6c5fe9ac018.tar.xz |
msg: log-file set at mpv.conf: don't ignore early messages
Previously, if log-file was set not via a CLI option (e.g. set via
mpv.conf or other config file, or set from a script init phase),
then meaningful early log messages were thrown away because the log
file name was unknown initially.
Such early log messages include the command line arguments, any
options set from mpv.conf, and possibly more.
Now we store up to 5000 early messages before the log file name is
known, and flush them once/if it becomes known, or destroy this
buffer once mpv init is complete.
The implementation is similar and adjacent, but not identical, to an
existing early log system for mpv clients which request a log buffer.
Diffstat (limited to 'player/main.c')
-rw-r--r-- | player/main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/player/main.c b/player/main.c index 2f4bede898..1dde63e31f 100644 --- a/player/main.c +++ b/player/main.c @@ -137,8 +137,12 @@ void mp_update_logging(struct MPContext *mpctx, bool preinit) } } - if (mp_msg_has_log_file(mpctx->global) && !had_log_file) - mp_print_version(mpctx->log, false); // for log-file=... in config files + if (mp_msg_has_log_file(mpctx->global) && !had_log_file) { + // for log-file=... in config files. + // we did flush earlier messages, but they were in a cyclic buffer, so + // the version might have been overwritten. ensure we have it. + mp_print_version(mpctx->log, false); + } if (enabled && !preinit && mpctx->opts->consolecontrols) terminal_setup_getch(mpctx->input); |