mirror of
https://github.com/monero-project/monero.git
synced 2025-08-19 04:28:03 -04:00
easylogging++: check allowed categories before logging
This commit is contained in:
parent
7e957c162a
commit
68f045de8c
3 changed files with 36 additions and 8 deletions
19
external/easylogging++/easylogging++.cc
vendored
19
external/easylogging++/easylogging++.cc
vendored
|
@ -2699,6 +2699,12 @@ Writer& Writer::construct(int count, const char* loggerIds, ...) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
Writer& Writer::construct(const char *loggerId) {
|
||||
initializeLogger(ELPP->registeredLoggers()->get(loggerId, ELPP->hasFlag(LoggingFlag::CreateLoggerAutomatically)));
|
||||
m_messageBuilder.initialize(m_logger);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Writer::initializeLogger(const std::string& loggerId, bool lookup, bool needLock) {
|
||||
if (lookup) {
|
||||
m_logger = ELPP->registeredLoggers()->get(loggerId, ELPP->hasFlag(LoggingFlag::CreateLoggerAutomatically));
|
||||
|
@ -2727,6 +2733,19 @@ void Writer::initializeLogger(const std::string& loggerId, bool lookup, bool nee
|
|||
}
|
||||
}
|
||||
|
||||
void Writer::initializeLogger(Logger *logger, bool needLock) {
|
||||
m_logger = logger;
|
||||
if (m_logger == nullptr) {
|
||||
m_proceed = false;
|
||||
} else {
|
||||
if (needLock) {
|
||||
m_logger->acquireLock(); // This should not be unlocked by checking m_proceed because
|
||||
// m_proceed can be changed by lines below
|
||||
}
|
||||
m_proceed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Writer::processDispatch() {
|
||||
#if ELPP_LOGGING_ENABLED
|
||||
if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) {
|
||||
|
|
2
external/easylogging++/easylogging++.h
vendored
2
external/easylogging++/easylogging++.h
vendored
|
@ -3290,6 +3290,7 @@ class Writer : base::NoCopy {
|
|||
|
||||
Writer& construct(Logger* logger, bool needLock = true);
|
||||
Writer& construct(int count, const char* loggerIds, ...);
|
||||
Writer& construct(const char *loggerId);
|
||||
protected:
|
||||
LogMessage* m_msg;
|
||||
Level m_level;
|
||||
|
@ -3305,6 +3306,7 @@ class Writer : base::NoCopy {
|
|||
friend class el::Helpers;
|
||||
|
||||
void initializeLogger(const std::string& loggerId, bool lookup = true, bool needLock = true);
|
||||
void initializeLogger(Logger *logger, bool needLock = true);
|
||||
void processDispatch();
|
||||
void triggerDispatch(void);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue