Merge pull request #4138

7f8bdeb easylogging++: make the logger handle early/late logging (moneromooo-monero)
bc8cbdb stack_trace: print stack traces on stdout if the logger isn't live (moneromooo-monero)
This commit is contained in:
luigi1111 2018-08-15 17:19:04 -05:00
commit 88369c6685
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 27 additions and 5 deletions

View file

@ -49,7 +49,16 @@
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "stacktrace"
#define ST_LOG(x) CINFO(el::base::Writer,el::base::DispatchAction::FileOnlyLog,MONERO_DEFAULT_LOG_CATEGORY) << x
#define ST_LOG(x) \
do { \
auto elpp = ELPP; \
if (elpp) { \
CINFO(el::base::Writer,el::base::DispatchAction::FileOnlyLog,MONERO_DEFAULT_LOG_CATEGORY) << x; \
} \
else { \
std::cout << x << std::endl; \
} \
} while(0)
// from https://stackoverflow.com/questions/11665829/how-can-i-print-stack-trace-for-caught-exceptions-in-c-code-injection-in-c