From 23b83c6676c17963a59febeac72fdc73a4198769 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 20 Jun 2015 21:40:47 +0200 Subject: client API: allow using msg-level option for log messages Client API users can enable log output with mpv_request_log_messages(). But you can enable only a single log level. This is normally enough, but the --msg-level option (which controls the terminal log level) provides more flexibility. Due to internal complexity, it would be hard to provide the same flexibility for each client API handle. But there's a simple way to achieve basically the same thing: add an option that sends log messages to the API handle, which would also be printed to the terminal as by --msg-level. The only change is that we don't disable this logic if the terminal is disabled. Instead we check for this before the message is output, which in theory can lower performance if messages are being spammed. It could be handled with some more effort, but the gain would be negligible. --- common/msg_control.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'common/msg_control.h') diff --git a/common/msg_control.h b/common/msg_control.h index c26a557c9e..d8d9b2e6e9 100644 --- a/common/msg_control.h +++ b/common/msg_control.h @@ -18,6 +18,9 @@ struct mp_log_buffer_entry { char *text; }; +// Use --msg-level option for log level of this log buffer +#define MP_LOG_BUFFER_MSGL_TERM (MSGL_MAX + 1) + struct mp_log_buffer; struct mp_log_buffer *mp_msg_log_buffer_new(struct mpv_global *global, int size, int level, -- cgit v1.2.3