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 /utils/log.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 'utils/log.c')
-rw-r--r-- | utils/log.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/utils/log.c b/utils/log.c index 96a6d3c5b..2aa39ee41 100644 --- a/utils/log.c +++ b/utils/log.c @@ -31,9 +31,9 @@ nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv) { nserror ret = NSERROR_OK; - if (((*pargc) > 1) && - (argv[1][0] == '-') && - (argv[1][1] == 'v') && + if (((*pargc) > 1) && + (argv[1][0] == '-') && + (argv[1][1] == 'v') && (argv[1][2] == 0)) { int argcmv; for (argcmv = 2; argcmv < (*pargc); argcmv++) { @@ -43,15 +43,17 @@ nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv) /* ensure we actually show logging */ verbose_log = true; - - /* ensure stderr is available */ - if (ensure != NULL) { - if (ensure(stderr) == false) { - /* failed to ensure output */ - ret = NSERROR_INIT_FAILED; - } - } } + + /* ensure output file handle is correctly configured */ + if ((verbose_log == true) && + (ensure != NULL) && + (ensure(stderr) == false)) { + /* failed to ensure output configuration */ + ret = NSERROR_INIT_FAILED; + verbose_log = false; + } + return ret; } |