summaryrefslogtreecommitdiff
path: root/framebuffer
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2013-05-23 11:50:57 +0100
committerVincent Sanders <vince@netsurf-browser.org>2013-05-23 11:50:57 +0100
commit35dacc36716bdac66bc2673a6725083dc265d310 (patch)
tree25592a597fcb355c71b0cb6feabc48f703de023b /framebuffer
parent12ff7a47f4426bc44103f0123d44fc111608ae18 (diff)
downloadnetsurf-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 'framebuffer')
-rw-r--r--framebuffer/gui.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 3ceb81479..4277557b4 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -516,6 +516,17 @@ gui_init(int argc, char** argv)
urldb_load_cookies(nsoption_charp(cookie_file));
}
+/**
+ * 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;
+}
+
/** Entry point from OS.
*
* /param argc The number of arguments in the string vector.
@@ -531,13 +542,16 @@ main(int argc, char** argv)
nsurl *url;
nserror error;
- setbuf(stderr, NULL);
-
respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);
options = filepath_find(respaths, "Choices");
messages = filepath_find(respaths, "messages");
+ /* initialise logging. Not fatal if it fails but not much we
+ * can do about it either.
+ */
+ nslog_init(nslog_stream_configure, &argc, argv);
+
netsurf_init(&argc, &argv, options, messages);
free(messages);