File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -418,6 +418,16 @@ Logging::normalizePartition(std::string const& partition)
418418std::recursive_mutex Logging::mLogMutex ;
419419
420420#if defined(USE_SPDLOG)
421+ LogPtr Logging::defaultLogPtr = nullptr ;
422+ LogPtr Logging::getDefaultLogPtr () \
423+ {
424+ std::lock_guard<std::recursive_mutex> guard (mLogMutex );
425+ if (!defaultLogPtr)
426+ {
427+ defaultLogPtr = spdlog::default_logger ();
428+ }
429+ return defaultLogPtr;
430+ }
421431#define LOG_PARTITION (name ) \
422432 LogPtr Logging::name##LogPtr = nullptr ; \
423433 LogPtr Logging::get##name##LogPtr() \
Original file line number Diff line number Diff line change 7676 SPDLOG_LOGGER_CRITICAL (lg, fmt, ##__VA_ARGS__))
7777
7878#define GET_LOG (name ) spdlog::get(name)
79- #define DEFAULT_LOG spdlog::default_logger ()
79+ #define DEFAULT_LOG stellar::Logging::getDefaultLogPtr ()
8080namespace stellar
8181{
8282typedef std::shared_ptr<spdlog::logger> LogPtr;
@@ -168,6 +168,7 @@ class Logging
168168 static std::string mLastPattern ;
169169 static std::string mLastFilenamePattern ;
170170 static bool mLogToConsole ;
171+ static LogPtr defaultLogPtr;
171172#define LOG_PARTITION (name ) static LogPtr name##LogPtr;
172173#include " util/LogPartitions.def"
173174#undef LOG_PARTITION
@@ -195,6 +196,7 @@ class Logging
195196 static std::array<std::string const , 15 > const kPartitionNames ;
196197
197198#if defined(USE_SPDLOG)
199+ static LogPtr getDefaultLogPtr ();
198200#define LOG_PARTITION (name ) static LogPtr get##name##LogPtr();
199201#include " util/LogPartitions.def"
200202#undef LOG_PARTITION
You can’t perform that action at this time.
0 commit comments