mirror of
https://github.com/monero-project/monero.git
synced 2026-07-30 15:40:24 -07:00
Fix logging deadlock
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "easylogging++.h"
|
||||
@@ -40,9 +41,15 @@
|
||||
#define MAX_LOG_FILE_SIZE 104850000 // 100 MB - 7600 bytes
|
||||
#define MAX_LOG_FILES 50
|
||||
|
||||
#define LOG_TO_STRING(x) \
|
||||
std::stringstream ss; \
|
||||
ss << x; \
|
||||
const std::string str = ss.str();
|
||||
|
||||
#define MCLOG_TYPE(level, cat, color, type, x) do { \
|
||||
if (el::Loggers::allowed(level, cat)) { \
|
||||
el::base::Writer(level, color, __FILE__, __LINE__, ELPP_FUNC, type).construct(cat) << x; \
|
||||
LOG_TO_STRING(x); \
|
||||
el::base::Writer(level, color, __FILE__, __LINE__, ELPP_FUNC, type).construct(cat) << str; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -91,7 +98,8 @@
|
||||
do { \
|
||||
if (el::Loggers::allowed(level, cat)) { \
|
||||
init; \
|
||||
el::base::Writer(level, color, __FILE__, __LINE__, ELPP_FUNC, type).construct(cat) << x; \
|
||||
LOG_TO_STRING(x); \
|
||||
el::base::Writer(level, color, __FILE__, __LINE__, ELPP_FUNC, type).construct(cat) << str; \
|
||||
} \
|
||||
} while(0)
|
||||
#define MIDEBUG(init, x) IFLOG(el::Level::Debug, MONERO_DEFAULT_LOG_CATEGORY, el::Color::Default, el::base::DispatchAction::NormalLog, init, x)
|
||||
|
||||
Reference in New Issue
Block a user