summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2017-09-10 13:22:05 (GMT)
committer Daniel Silverstone <dsilvers@digital-scurf.org>2017-09-10 13:22:05 (GMT)
commit8123e65351788fa633962c4f5e1bb41f1ef346e2 (patch)
tree94a03b6da798aeca180226a9b4adfd34bfd8b274
parentec94d5f812723c586b26d4c1700b641e5cb2f7a0 (diff)
downloadnetsurf-8123e65351788fa633962c4f5e1bb41f1ef346e2.tar.gz
netsurf-8123e65351788fa633962c4f5e1bb41f1ef346e2.tar.bz2
Finalise nslog layer properly in closedown
-rw-r--r--frontends/amiga/gui.c3
-rw-r--r--frontends/atari/gui.c4
-rw-r--r--frontends/beos/gui.cpp6
-rw-r--r--frontends/framebuffer/gui.c3
-rw-r--r--frontends/gtk/gui.c3
-rw-r--r--frontends/monkey/main.c3
-rw-r--r--frontends/riscos/gui.c3
-rw-r--r--frontends/windows/main.c3
-rw-r--r--utils/log.c18
-rw-r--r--utils/log.h9
10 files changed, 54 insertions, 1 deletions
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index e4acf70..fbaa2ac 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -5841,6 +5841,9 @@ int main(int argc, char** argv)
free(current_user_dir);
FreeVec(current_user_faviconcache);
+ /* finalise logging */
+ nslog_finalise();
+
#ifndef __amigaos4__
/* OS3 low memory handler */
ami_memory_fini(memhandler);
diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c
index a400285..6ee63b3 100644
--- a/frontends/atari/gui.c
+++ b/frontends/atari/gui.c
@@ -1225,6 +1225,10 @@ int main(int argc, char** argv)
fclose(stderr);
#endif
NSLOG(netsurf, INFO, "exit_gem");
+
+ /* finalise logging */
+ nslog_finalise();
+
exit_gem();
return 0;
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index 69a0d6d..19f8eac 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -1066,6 +1066,12 @@ int main(int argc, char** argv)
netsurf_exit();
+ /* finalise options */
+ nsoption_finalise(nsoptions, nsoptions_default);
+
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c
index ebd0b7b..e252f25 100644
--- a/frontends/framebuffer/gui.c
+++ b/frontends/framebuffer/gui.c
@@ -2215,6 +2215,9 @@ main(int argc, char** argv)
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index 6a61b3d..8c9ad08 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -1198,5 +1198,8 @@ int main(int argc, char** argv)
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c
index d697f27..53cde5a 100644
--- a/frontends/monkey/main.c
+++ b/frontends/monkey/main.c
@@ -404,5 +404,8 @@ main(int argc, char **argv)
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index 9d651bc..cfc513f 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -2557,5 +2557,8 @@ int main(int argc, char** argv)
netsurf_exit();
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 98e90be..a3a7c2b 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -419,5 +419,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/utils/log.c b/utils/log.c
index 68a470a..e267b31 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 a94afc1..b773ec4 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.