diff options
Diffstat (limited to 'src/logging.cpp')
-rw-r--r-- | src/logging.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/logging.cpp b/src/logging.cpp index 77dc2d0939..36cad6573a 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -8,6 +8,8 @@ const char * const DEFAULT_DEBUGLOGFILE = "debug.log"; +BCLog::Logger& LogInstance() +{ /** * NOTE: the logger instances is leaked on exit. This is ugly, but will be * cleaned up by the OS/libc. Defining a logger as a global object doesn't work @@ -17,11 +19,15 @@ const char * const DEFAULT_DEBUGLOGFILE = "debug.log"; * access the logger. When the shutdown sequence is fully audited and tested, * explicit destruction of these objects can be implemented by changing this * from a raw pointer to a std::unique_ptr. + * Since the destructor is never called, the logger and all its members must + * have a trivial destructor. * * This method of initialization was originally introduced in * ee3374234c60aba2cc4c5cd5cac1c0aefc2d817c. */ -BCLog::Logger* const g_logger = new BCLog::Logger(); + static BCLog::Logger* g_logger{new BCLog::Logger()}; + return *g_logger; +} bool fLogIPs = DEFAULT_LOGIPS; |