diff options
author | wm4 <wm4@nowhere> | 2013-12-15 21:16:51 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-16 20:02:59 +0100 |
commit | 048bb2464dbd9a3f9d53cc0d044c05cb7e21ca5b (patch) | |
tree | a88db4b411487f3ee1e29f3fa59a23ca56c1f0f1 /mpvcore | |
parent | cd064c679c3cfc923daee748b3b7afc15d5d37f1 (diff) | |
download | mpv-048bb2464dbd9a3f9d53cc0d044c05cb7e21ca5b.tar.bz2 mpv-048bb2464dbd9a3f9d53cc0d044c05cb7e21ca5b.tar.xz |
mp_msg: define a bunch of convenience macros
In order to use bare mp_log contexts, I find myself creating dummy
structs (with a single "log" field) to use the MP_ERR() etc. macros,
which hardcode the idiom that a context struct has a log field. On the
other hand, just using mp_msg_log() is too much typing (and I want to
rename it to mp_msg() when the transition is done), so it seems nice to
have message printing macros that use mp_log directly.
Diffstat (limited to 'mpvcore')
-rw-r--r-- | mpvcore/mp_msg.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mpvcore/mp_msg.h b/mpvcore/mp_msg.h index 4c5b6eabfb..306b8145e1 100644 --- a/mpvcore/mp_msg.h +++ b/mpvcore/mp_msg.h @@ -165,6 +165,14 @@ void mp_msg_log(struct mp_log *log, int lev, const char *format, ...) #define MP_DBG(obj, ...) MP_MSG(obj, MSGL_DBG2, __VA_ARGS__) #define MP_TRACE(obj, ...) MP_MSG(obj, MSGL_DBG5, __VA_ARGS__) +#define mp_fatal(log, ...) mp_msg_log(log, MSGL_FATAL, __VA_ARGS__) +#define mp_err(log, ...) mp_msg_log(log, MSGL_ERR, __VA_ARGS__) +#define mp_warn(log, ...) mp_msg_log(log, MSGL_WARN, __VA_ARGS__) +#define mp_info(log, ...) mp_msg_log(log, MSGL_INFO, __VA_ARGS__) +#define mp_verbose(log, ...) mp_msg_log(log, MSGL_V, __VA_ARGS__) +//#define mp_dbg(log, ...) mp_msg_log(log, MSGL_DBG2, __VA_ARGS__) +#define mp_trace(log, ...) mp_msg_log(log, MSGL_DBG5, __VA_ARGS__) + struct mpv_global; void mp_msg_init(struct mpv_global *global); void mp_msg_uninit(struct mpv_global *global); |