diff --git a/README.md b/README.md index e5670e8cd..946686feb 100644 --- a/README.md +++ b/README.md @@ -369,10 +369,11 @@ Please note, this date/time functionality is built-in hence is cross-platform. ###Logging flags Form some parts of logging you can set logging flags; here are flags supported: -| Flag | Description | -|------------------------------------|------------------------------------------------------------------------------------------------------------------| -| NewLineForContainer | Makes sure we have new line for each container log entry | +| Flag | Description | +|------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| +| NewLineForContainer | Makes sure we have new line for each container log entry | | AllowVerboseIfModuleNotSpecified | Makes sure if -vmodule is used and does not specifies a module, then verbose logging is allowed via that module. Say param was -vmodule=main*=3 and a verbose log is being written from a file called something.cpp then if this flag is enabled, log will be written otherwise it will be disallowed. Note: having this defeats purpose of -vmodule | +| LogDetailedCrashReason | When handling crashes by default, detailed crash reason will be logged as well [issue #90](https://github.com/easylogging/easyloggingpp/issues/90) | You can set these flags by using static el::Helpers::addFlag and el::Helpers::removeFlag. You can check to see if certain flag is available by using el::Helpers::hasFlag, all these functions take strong enums el::LoggingFlag diff --git a/src/easylogging++.h b/src/easylogging++.h index a0e5684bc..3c11a8a9f 100755 --- a/src/easylogging++.h +++ b/src/easylogging++.h @@ -614,13 +614,17 @@ class ConfigurationTypeHelper: private base::StaticClass { enum class LoggingFlag : unsigned short { /// @brief Makes sure we have new line for each container log entry NewLineForContainer = 1, + /// @brief Makes sure if -vmodule is used and does not specifies a module, then verbose /// logging is allowed via that module. /// /// @detail Say param was -vmodule=main*=3 and a verbose log is being written from a file /// called something.cpp then if this flag is enabled, log will be written otherwise /// it will be disallowed. - AllowVerboseIfModuleNotSpecified = 2 + AllowVerboseIfModuleNotSpecified = 2, + + /// @brief When handling crashes by default, detailed crash reason will be logged as well + LogDetailedCrashReason }; namespace base { @@ -3127,6 +3131,7 @@ class Storage : private base::NoCopy { performanceLogger->refConfigurations().setGlobally(ConfigurationType::Format, "%datetime %level %log"); performanceLogger->reconfigure(); addFlag(LoggingFlag::AllowVerboseIfModuleNotSpecified); + addFlag(LoggingFlag::LogDetailedCrashReason); } virtual ~Storage(void) { @@ -4056,9 +4061,12 @@ static void logCrashReason(int sig, bool stackTraceIfAvailable, const Level& lev if (base::consts::kCrashSignals[i].numb == sig) { ss << "Application has crashed due to [" << base::consts::kCrashSignals[i].name << - "] signal" << std::endl << - " " << base::consts::kCrashSignals[i].brief << std::endl << - " " << base::consts::kCrashSignals[i].detail; + "] signal"; + if (base::elStorage->hasFlag(el::LoggingFlag::LogDetailedCrashReason)) { + ss << std::endl << + " " << base::consts::kCrashSignals[i].brief << std::endl << + " " << base::consts::kCrashSignals[i].detail; + } foundReason = true; } }