summaryrefslogtreecommitdiff
path: root/utils/log.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-04-02 13:05:55 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-04-02 13:05:55 +0000
commit74ffc40e9238c9897ae47b8118f642565e9654a0 (patch)
tree745b3c7936a1675e4d1e57f0be341518aa9e00ed /utils/log.h
parenta65d235a173b52a47bfdf62396c51747529d38ba (diff)
downloadnetsurf-74ffc40e9238c9897ae47b8118f642565e9654a0.tar.gz
netsurf-74ffc40e9238c9897ae47b8118f642565e9654a0.tar.bz2
move logging initialisation
svn path=/trunk/netsurf/; revision=12152
Diffstat (limited to 'utils/log.h')
-rw-r--r--utils/log.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/log.h b/utils/log.h
index b59b6d3f8..84a211d95 100644
--- a/utils/log.h
+++ b/utils/log.h
@@ -22,11 +22,34 @@
#include <stdio.h>
#include "desktop/netsurf.h"
+#include "utils/errors.h"
#ifdef NDEBUG
# define LOG(x) ((void) 0)
#else
+
+/**
+ * Ensures the FILE handle is available to write logging to.
+ *
+ * This is provided by the frontends if required
+ */
+typedef bool(nslog_ensure_t)(FILE *fptr);
+
+/**
+ * Initialise the logging system.
+ *
+ * Sets up everything required for logging. Processes the argv passed
+ * to remove the -v switch for verbose logging. If necessary ensures
+ * the output file handle is available.
+ */
+extern nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv);
+
+/**
+ * Obtain a formatted string suitable for prepending to a log message
+ *
+ * \return formatted string of the time since first log call
+ */
extern const char *nslog_gettime(void);
extern void nslog_log(const char *format, ...);