aboutsummaryrefslogtreecommitdiff
path: root/bsd-user/main.c
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2019-01-31 17:46:14 +0100
committerMarkus Armbruster <armbru@redhat.com>2019-04-17 19:08:27 +0200
commitf5852efa293e1dc240cdfde30b42cea1f780a1f2 (patch)
tree6c578b4ed60d5c891ae4ac4d4db366c56aed92cb /bsd-user/main.c
parent99e98d7c9fc1a1639fad2c638733b02f4b43aebe (diff)
downloadqemu-f5852efa293e1dc240cdfde30b42cea1f780a1f2.zip
qemu-f5852efa293e1dc240cdfde30b42cea1f780a1f2.tar.gz
qemu-f5852efa293e1dc240cdfde30b42cea1f780a1f2.tar.bz2
log: Make glib logging go through QEMU
This commit adds a error_init() helper which calls g_log_set_default_handler() so that glib logs (g_log, g_warning, ...) are handled similarly to other QEMU logs. This means they will get a timestamp if timestamps are enabled, and they will go through the HMP monitor if one is configured. This commit also adds a call to error_init() to the binaries installed by QEMU. Since error_init() also calls error_set_progname(), this means that *-linux-user, *-bsd-user and qemu-pr-helper messages output with error_report, info_report, ... will slightly change: they will be prefixed by the binary name. glib debug messages are enabled through G_MESSAGES_DEBUG similarly to the glib default log handler. At the moment, this change will mostly impact SPICE logging if your spice version is >= 0.14.1. With older spice versions, this is not going to work as expected, but will not have any ill effect, so this call is not conditional on the SPICE version. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20190131164614.19209-3-cfergeau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'bsd-user/main.c')
-rw-r--r--bsd-user/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0d31569..8fd8ae4 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -24,6 +24,7 @@
#include "qapi/error.h"
#include "qemu.h"
#include "qemu/config-file.h"
+#include "qemu/error-report.h"
#include "qemu/path.h"
#include "qemu/help_option.h"
#include "cpu.h"
@@ -743,6 +744,7 @@ int main(int argc, char **argv)
if (argc <= 1)
usage();
+ error_init(argv[0]);
module_call_init(MODULE_INIT_TRACE);
qemu_init_cpu_list();
module_call_init(MODULE_INIT_QOM);