test/run_convert: implement a GLib log callback

Log to stderr instead of the default stdout.  We need a pristine
stdout for the conversion result.
This commit is contained in:
Max Kellermann 2010-01-16 23:44:16 +01:00
parent 8f326a33ee
commit 87c861cae3

View File

@ -36,6 +36,16 @@
#include <stddef.h> #include <stddef.h>
#include <unistd.h> #include <unistd.h>
static void
my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
const gchar *message, G_GNUC_UNUSED gpointer user_data)
{
if (log_domain != NULL)
g_printerr("%s: %s\n", log_domain, message);
else
g_printerr("%s\n", message);
}
const char * const char *
config_get_string(G_GNUC_UNUSED const char *name, const char *default_value) config_get_string(G_GNUC_UNUSED const char *name, const char *default_value)
{ {
@ -56,6 +66,8 @@ int main(int argc, char **argv)
return 1; return 1;
} }
g_log_set_default_handler(my_log_func, NULL);
if (!audio_format_parse(&in_audio_format, argv[1], if (!audio_format_parse(&in_audio_format, argv[1],
false, &error)) { false, &error)) {
g_printerr("Failed to parse audio format: %s\n", g_printerr("Failed to parse audio format: %s\n",