summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/log.c18
-rw-r--r--utils/log.h9
2 files changed, 26 insertions, 1 deletions
diff --git a/utils/log.c b/utils/log.c
index 68a470aa9..e267b3179 100644
--- a/utils/log.c
+++ b/utils/log.c
@@ -137,8 +137,8 @@ nslog_set_filter(const char *filter)
}
err = nslog_filter_set_active(filt, NULL);
+ filt = nslog_filter_unref(filt);
if (err != NSLOG_NO_ERROR) {
- nslog_filter_unref(filt);
return NSERROR_NOSPACE;
}
@@ -287,3 +287,19 @@ nslog_set_filter_by_options()
else
return nslog_set_filter(nsoption_charp(log_filter));
}
+
+/* exported interface documented in utils/log.h */
+void
+nslog_finalise()
+{
+ NSLOG(netsurf, INFO,
+ "Finalising logging, please report any further messages");
+ verbose_log = true;
+ if (logfile != stderr) {
+ fclose(logfile);
+ logfile = stderr;
+ }
+#ifdef WITH_NSLOG
+ nslog_cleanup();
+#endif
+}
diff --git a/utils/log.h b/utils/log.h
index a94afc130..b773ec4a2 100644
--- a/utils/log.h
+++ b/utils/log.h
@@ -44,6 +44,15 @@ typedef bool(nslog_ensure_t)(FILE *fptr);
extern nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv);
/**
+ * Shut down the logging system.
+ *
+ * Shuts down the logging subsystem, resetting to verbose logging and output
+ * to stderr. Note, if logging is done after calling this, it will be sent
+ * to stderr without filtering.
+ */
+extern void nslog_finalise(void);
+
+/**
* Set the logging filter.
*
* Compiles and enables the given logging filter.