Commit 4407e9e4 authored by Philip Withnall's avatar Philip Withnall

gs-plugin-loader: Rework plugin setup logging

This reduces code duplication, and downgrades the warning to a debug
statement if running in the tests, as CI machine slowness can cause
spurious failures otherwise (warnings are fatal in the tests).
Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
parent 12483df8
Pipeline #195049 failed with stage
in 10 minutes and 46 seconds
...@@ -770,26 +770,31 @@ gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper, ...@@ -770,26 +770,31 @@ gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper,
#endif /* HAVE_SYSPROF */ #endif /* HAVE_SYSPROF */
/* check the plugin didn't take too long */ /* check the plugin didn't take too long */
if (g_timer_elapsed (timer, NULL) > 1.0f) {
GLogLevelFlags log_level;
switch (action) { switch (action) {
case GS_PLUGIN_ACTION_INITIALIZE: case GS_PLUGIN_ACTION_INITIALIZE:
case GS_PLUGIN_ACTION_DESTROY: case GS_PLUGIN_ACTION_DESTROY:
case GS_PLUGIN_ACTION_SETUP: case GS_PLUGIN_ACTION_SETUP:
if (g_timer_elapsed (timer, NULL) > 1.0f) { if (g_getenv ("GS_SELF_TEST_PLUGIN_ERROR_FAIL_HARD") == NULL)
g_warning ("plugin %s took %.1f seconds to do %s", log_level = G_LOG_LEVEL_WARNING;
gs_plugin_get_name (plugin), else
g_timer_elapsed (timer, NULL), log_level = G_LOG_LEVEL_DEBUG;
gs_plugin_action_to_string (action));
}
break; break;
default: default:
if (g_timer_elapsed (timer, NULL) > 1.0f) { log_level = G_LOG_LEVEL_DEBUG;
g_debug ("plugin %s took %.1f seconds to do %s", break;
}
g_log_structured_standard (G_LOG_DOMAIN, log_level,
__FILE__, G_STRINGIFY (__LINE__),
G_STRFUNC,
"plugin %s took %.1f seconds to do %s",
gs_plugin_get_name (plugin), gs_plugin_get_name (plugin),
g_timer_elapsed (timer, NULL), g_timer_elapsed (timer, NULL),
gs_plugin_action_to_string (action)); gs_plugin_action_to_string (action));
} }
break;
}
/* success */ /* success */
helper->anything_ran = TRUE; helper->anything_ran = TRUE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment