gmessages: Only use structured logs if GLIB_VERSION_MAX_ALLOWED is ≥2.56

Only redefine g_message() and friends to use structured logging if the
compiling code is OK with depending on GLib functionality from ≥2.56.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1847
This commit is contained in:
Philip Withnall 2019-07-26 20:49:01 +01:00
parent 517f756acf
commit 54f94b1303

View File

@ -296,7 +296,7 @@ void g_log_structured_standard (const gchar *log_domain,
#endif /* G_LOG_DOMAIN */
#if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING
#ifdef G_LOG_USE_STRUCTURED
#if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
#define g_error(...) G_STMT_START { \
g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
__FILE__, G_STRINGIFY (__LINE__), \
@ -345,7 +345,7 @@ void g_log_structured_standard (const gchar *log_domain,
__VA_ARGS__)
#endif
#elif defined(G_HAVE_GNUC_VARARGS) && !G_ANALYZER_ANALYZING
#ifdef G_LOG_USE_STRUCTURED
#if defined(G_LOG_USE_STRUCTURED) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56
#define g_error(format...) G_STMT_START { \
g_log_structured_standard (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \
__FILE__, G_STRINGIFY (__LINE__), \