diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 09:34:42 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 09:34:42 +0100 |
commit | 1fe4b0e07c2ed1d521dfabc6f3f564932fcf3224 (patch) | |
tree | 921083546a4c686cc7d475b9c1e53d1052b0660d /tools/libxl/xl.c | |
parent | 4046aa9cbed80adad144103ab29e0ac9d171dbf4 (diff) | |
download | xen-1fe4b0e07c2ed1d521dfabc6f3f564932fcf3224.tar.gz xen-1fe4b0e07c2ed1d521dfabc6f3f564932fcf3224.tar.bz2 xen-1fe4b0e07c2ed1d521dfabc6f3f564932fcf3224.zip |
libxl: Use the caller's logger (xentoollog)
We now require callers to provide a xentoollog_logger* for
libxl_ctx_init, and use that for all our own logging and also for
xc_interface_open.
Corresponding change to xl.c.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/xl.c')
-rw-r--r-- | tools/libxl/xl.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c index 77eaa7b087..8b106741de 100644 --- a/tools/libxl/xl.c +++ b/tools/libxl/xl.c @@ -31,16 +31,7 @@ #include "libxl_utils.h" #include "xl.h" -void log_callback( - void *userdata, int loglevel, const char *file, - int line, const char *func, char *s) -{ - char str[1024]; - - snprintf(str, sizeof(str), "[%d] %s:%d:%s: %s\n", - loglevel, file, line, func, s); - libxl_write_exactly(NULL, logfile, str, strlen(str), NULL, NULL); -} +xentoollog_logger *logger; int main(int argc, char **argv) { @@ -51,14 +42,11 @@ int main(int argc, char **argv) exit(1); } - if (libxl_ctx_init(&ctx, LIBXL_VERSION)) { + logger = xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0); + if (libxl_ctx_init(&ctx, LIBXL_VERSION, logger)) { fprintf(stderr, "cannot init xl context\n"); exit(1); } - if (libxl_ctx_set_log(&ctx, log_callback, NULL)) { - fprintf(stderr, "cannot set xl log callback\n"); - exit(-ERROR_FAIL); - } srand(time(0)); |