diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2013-05-23 11:50:57 +0100 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2013-05-23 11:50:57 +0100 |
commit | 35dacc36716bdac66bc2673a6725083dc265d310 (patch) | |
tree | 25592a597fcb355c71b0cb6feabc48f703de023b /riscos/gui.c | |
parent | 12ff7a47f4426bc44103f0123d44fc111608ae18 (diff) | |
download | netsurf-35dacc36716bdac66bc2673a6725083dc265d310.tar.gz netsurf-35dacc36716bdac66bc2673a6725083dc265d310.tar.bz2 |
move the logging initialisation out to be call by frontends
This allows each frontend to pass a distinct callback to configure the
output file stream appropriately for their use.
Diffstat (limited to 'riscos/gui.c')
-rw-r--r-- | riscos/gui.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/riscos/gui.c b/riscos/gui.c index 53f281dd8..bca2a701a 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -799,6 +799,17 @@ static void gui_init2(int argc, char** argv) free(url); } +/** + * Ensures output logging stream is correctly configured + */ +static bool nslog_stream_configure(FILE *fptr) +{ + /* set log stream to be non-buffering */ + setbuf(fptr, NULL); + + return true; +} + /** Normal entry point from OS */ int main(int argc, char** argv) { @@ -809,8 +820,6 @@ int main(int argc, char** argv) int used = -1; /* slightly better with older OSLib versions */ os_error *error; - setbuf(stderr, NULL); - /* Consult NetSurf$Logging environment variable to decide if logging * is required. */ error = xos_read_var_val_size("NetSurf$Logging", 0, os_VARTYPE_STRING, @@ -828,6 +837,11 @@ int main(int argc, char** argv) } } + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(nslog_stream_configure, &argc, argv); + /* Pass a NULL pointer for Messages path, because until the Choices * are loaded in netsurf_init, we don't know the Messages path. */ netsurf_init(&argc, &argv, "NetSurf:Choices", NULL); |