diff options
author | wm4 <wm4@nowhere> | 2017-01-14 16:47:53 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-01-14 17:13:50 +0100 |
commit | 191cdbd31ed6f4a8fbbd55a6ec81db7dcc1d457c (patch) | |
tree | e7b08ed21a24559ddb64dc013b3a2cbe2991d258 | |
parent | ddaab3349b2826acd6ca1fa82b5f1d7d5944cd72 (diff) |
scripting: minor logging improvements
Give scripting backends a proper name, instead of calling everything
"scripts".
Log client exit directly in client.c, as that is more general (doesn't
change actual output).
-rw-r--r-- | player/client.c | 2 | ||||
-rw-r--r-- | player/core.h | 1 | ||||
-rw-r--r-- | player/lua.c | 1 | ||||
-rw-r--r-- | player/scripting.c | 10 |
4 files changed, 9 insertions, 5 deletions
diff --git a/player/client.c b/player/client.c index 0b97945da2..88926f3544 100644 --- a/player/client.c +++ b/player/client.c @@ -359,6 +359,8 @@ void mpv_detach_destroy(mpv_handle *ctx) if (!ctx) return; + MP_VERBOSE(ctx, "Exiting...\n"); + // reserved_events equals the number of asynchronous requests that weren't // yet replied. In order to avoid that trying to reply to a removed client // causes a crash, block until all asynchronous requests were served. diff --git a/player/core.h b/player/core.h index d7510a79fe..d7ff507524 100644 --- a/player/core.h +++ b/player/core.h @@ -550,6 +550,7 @@ void update_screensaver_state(struct MPContext *mpctx); // scripting.c struct mp_scripting { + const char *name; // e.g. "lua script" const char *file_ext; // e.g. "lua" int (*load)(struct mpv_handle *client, const char *filename); }; diff --git a/player/lua.c b/player/lua.c index e76dc46fca..ce9387bdae 100644 --- a/player/lua.c +++ b/player/lua.c @@ -1331,6 +1331,7 @@ static void add_functions(struct script_ctx *ctx) } const struct mp_scripting mp_scripting_lua = { + .name = "lua script", .file_ext = "lua", .load = load_lua, }; diff --git a/player/scripting.c b/player/scripting.c index 2469b67678..a72668d050 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -84,13 +84,12 @@ static void *script_thread(void *p) struct thread_arg *arg = p; char name[90]; - snprintf(name, sizeof(name), "lua (%s)", mpv_client_name(arg->client)); + snprintf(name, sizeof(name), "%s (%s)", arg->backend->name, + mpv_client_name(arg->client)); mpthread_set_name(name); if (arg->backend->load(arg->client, arg->fname) < 0) - MP_ERR(arg, "Could not load script %s\n", arg->fname); - - MP_VERBOSE(arg, "Exiting...\n"); + MP_ERR(arg, "Could not load %s %s\n", arg->backend->name, arg->fname); mpv_detach_destroy(arg->client); talloc_free(arg); @@ -137,7 +136,7 @@ int mp_load_script(struct MPContext *mpctx, const char *fname) } arg->log = mp_client_get_log(arg->client); - MP_VERBOSE(arg, "Loading script %s...\n", fname); + MP_VERBOSE(arg, "Loading %s %s...\n", backend->name, fname); pthread_t thread; if (pthread_create(&thread, NULL, script_thread, arg)) { @@ -257,6 +256,7 @@ error: } const struct mp_scripting mp_scripting_cplugin = { + .name = "SO plugin", .file_ext = "so", .load = load_cplugin, }; |