mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 06:38:11 +02:00
test: redirect glib logging to stdout
Default g_log() logs to stdout for INFO level and higher, but logs to stderr for DEBUG/TRACE. That is annoying, because especially when redirecting the streams, the messages get mixed up. Install a log handler and just print to stdout for the tests.
This commit is contained in:
parent
1fcc3c8c39
commit
80e585a65d
1 changed files with 14 additions and 0 deletions
|
|
@ -282,6 +282,15 @@ nmtst_free (void)
|
||||||
memset (&__nmtst_internal, 0, sizeof (__nmtst_internal));
|
memset (&__nmtst_internal, 0, sizeof (__nmtst_internal));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_nmtst_log_handler (const gchar *log_domain,
|
||||||
|
GLogLevelFlags log_level,
|
||||||
|
const gchar *message,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
g_print ("%s\n", message);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
__nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_level, const char *log_domains, gboolean *out_set_logging)
|
__nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_level, const char *log_domains, gboolean *out_set_logging)
|
||||||
{
|
{
|
||||||
|
|
@ -591,6 +600,11 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_log_set_handler (G_LOG_DOMAIN,
|
||||||
|
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
|
||||||
|
_nmtst_log_handler,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _NMTST_INSIDE_CORE
|
#ifndef _NMTST_INSIDE_CORE
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue