From 35dacc36716bdac66bc2673a6725083dc265d310 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 23 May 2013 11:50:57 +0100 Subject: 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. --- monkey/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'monkey/main.c') diff --git a/monkey/main.c b/monkey/main.c index 03421ef03..26d6b321f 100644 --- a/monkey/main.c +++ b/monkey/main.c @@ -97,6 +97,17 @@ void gui_options_init_defaults(void) /* Set defaults for absent option strings */ } +/** + * 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; +} + int main(int argc, char **argv) { @@ -115,6 +126,11 @@ main(int argc, char **argv) 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); -- cgit v1.2.3