Skip to content

Commit

Permalink
adding pragma ifdef async logger
Browse files Browse the repository at this point in the history
  • Loading branch information
remibettan committed Jan 5, 2021
1 parent 52347ec commit bb57a4a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions third-party/easyloggingpp/src/easylogging++.cc
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,16 @@ Logger& Logger::operator=(const Logger& logger) {
}

void Logger::configure(const Configurations& configurations) {
#if ELPP_ASYNC_LOGGING
if (ELPP) {
base::threading::ScopedLock scopedLockConfig(ELPP->configLock());
performConfig(configurations);
}
else
performConfig(configurations);
#else
performConfig(configurations);
#endif // ELPP_ASYNC_LOGGING
}

void Logger::performConfig(const Configurations& configurations) {
Expand Down Expand Up @@ -2353,18 +2357,12 @@ bool AsyncDispatchWorker::clean(void) {
}

void AsyncDispatchWorker::emptyLogQueue(void) {
if (ELPP && ELPP->asyncLogReadQueue())
{
try // TODO Thread-safety
{
for (auto i=0UL; i < ELPP->asyncLogReadQueue()->size(); i++)
{
AsyncLogItem data = ELPP->asyncLogReadQueue()->next();
handle(&data);
if (ELPP && ELPP->asyncLogReadQueue()) {
for (auto i=0UL; i < ELPP->asyncLogReadQueue()->size(); i++) {
AsyncLogItem data = ELPP->asyncLogReadQueue()->next();
handle(&data);
}
}
catch(...){}
}
}
}

void AsyncDispatchWorker::start(void) {
Expand Down

0 comments on commit bb57a4a

Please sign in to comment.