Merge pull request #4840

721aacd8 easylogging++: faster access to logging (moneromooo-monero)
7cc27b36 Revert "easylogging++: make the logger handle early/late logging" (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-12-12 11:54:11 +02:00
commit 5123749d79
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
3 changed files with 18 additions and 14 deletions

View File

@ -17,3 +17,12 @@
fun:maybe_unlock_and_signal_one<boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex> > fun:maybe_unlock_and_signal_one<boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex> >
... ...
} }
{
we leak the logger, for performance reasons in on-the-fly init
Memcheck:Leak
match-leak-kinds: definite
fun:_Znwm
fun:_ZN2el4base7Storage7getELPPEv
...
}

View File

@ -2191,16 +2191,11 @@ void VRegistry::setFromArgs(const base::utils::CommandLineArgs* commandLineArgs)
# define ELPP_DEFAULT_LOGGING_FLAGS 0x0 # define ELPP_DEFAULT_LOGGING_FLAGS 0x0
#endif // !defined(ELPP_DEFAULT_LOGGING_FLAGS) #endif // !defined(ELPP_DEFAULT_LOGGING_FLAGS)
// Storage // Storage
el::base::type::StoragePointer getresetELPP(bool reset) el::base::type::StoragePointer &el::base::Storage::getELPP()
{ {
static el::base::type::StoragePointer p(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()))); if (!el::base::elStorage)
if (reset) el::base::elStorage = new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()));
p = NULL; return el::base::elStorage;
return p;
}
el::base::type::StoragePointer el::base::Storage::getELPP()
{
return getresetELPP(false);
} }
#if ELPP_ASYNC_LOGGING #if ELPP_ASYNC_LOGGING
Storage::Storage(const LogBuilderPtr& defaultLogBuilder, base::IWorker* asyncDispatchWorker) : Storage::Storage(const LogBuilderPtr& defaultLogBuilder, base::IWorker* asyncDispatchWorker) :
@ -2250,7 +2245,6 @@ Storage::Storage(const LogBuilderPtr& defaultLogBuilder) :
Storage::~Storage(void) { Storage::~Storage(void) {
ELPP_INTERNAL_INFO(4, "Destroying storage"); ELPP_INTERNAL_INFO(4, "Destroying storage");
getresetELPP(true);
#if ELPP_ASYNC_LOGGING #if ELPP_ASYNC_LOGGING
ELPP_INTERNAL_INFO(5, "Replacing log dispatch callback to synchronous"); ELPP_INTERNAL_INFO(5, "Replacing log dispatch callback to synchronous");
uninstallLogDispatchCallback<base::AsyncLogDispatchCallback>(std::string("AsyncLogDispatchCallback")); uninstallLogDispatchCallback<base::AsyncLogDispatchCallback>(std::string("AsyncLogDispatchCallback"));

View File

@ -552,7 +552,7 @@ typedef std::ostream ostream_t;
typedef unsigned int EnumType; typedef unsigned int EnumType;
typedef unsigned short VerboseLevel; typedef unsigned short VerboseLevel;
typedef unsigned long int LineNumber; typedef unsigned long int LineNumber;
typedef std::shared_ptr<base::Storage> StoragePointer; typedef base::Storage *StoragePointer;
typedef std::shared_ptr<LogDispatchCallback> LogDispatchCallbackPtr; typedef std::shared_ptr<LogDispatchCallback> LogDispatchCallbackPtr;
typedef std::shared_ptr<PerformanceTrackingCallback> PerformanceTrackingCallbackPtr; typedef std::shared_ptr<PerformanceTrackingCallback> PerformanceTrackingCallbackPtr;
typedef std::shared_ptr<LoggerRegistrationCallback> LoggerRegistrationCallbackPtr; typedef std::shared_ptr<LoggerRegistrationCallback> LoggerRegistrationCallbackPtr;
@ -2734,7 +2734,7 @@ class Storage : base::NoCopy, public base::threading::ThreadSafe {
return it->second; return it->second;
} }
static el::base::type::StoragePointer getELPP(); static el::base::type::StoragePointer &getELPP();
private: private:
base::RegisteredHitCounters* m_registeredHitCounters; base::RegisteredHitCounters* m_registeredHitCounters;
@ -4613,9 +4613,10 @@ el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER); \
} }
#if ELPP_ASYNC_LOGGING #if ELPP_ASYNC_LOGGING
# define INITIALIZE_EASYLOGGINGPP ELPP_INIT_EASYLOGGINGPP(NULL) # define INITIALIZE_EASYLOGGINGPP ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()),\
new el::base::AsyncDispatchWorker()))
#else #else
# define INITIALIZE_EASYLOGGINGPP ELPP_INIT_EASYLOGGINGPP(NULL) # define INITIALIZE_EASYLOGGINGPP ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder())))
#endif // ELPP_ASYNC_LOGGING #endif // ELPP_ASYNC_LOGGING
#define INITIALIZE_NULL_EASYLOGGINGPP \ #define INITIALIZE_NULL_EASYLOGGINGPP \
namespace el {\ namespace el {\