mirror of
https://github.com/KjellKod/g3log.git
synced 2025-03-04 19:13:31 +01:00
Same change as under other g2log-g3log repos, opened up for way easier change
of fatal handler
This commit is contained in:
parent
55d91601b8
commit
a9eb7714d6
@ -161,7 +161,7 @@ namespace g2 {
|
||||
* will sleep forever (i.e. until the background thread catches up, saves the fatal
|
||||
* message and kills the software with the fatal signal.
|
||||
*/
|
||||
void fatalCallToLogger(FatalMessagePtr message) {
|
||||
void pushFatalMessageToLogger(FatalMessagePtr message) {
|
||||
if (!isLoggingInitialized()) {
|
||||
std::ostringstream error;
|
||||
error << "FATAL CALL but logger is NOT initialized\n"
|
||||
@ -177,8 +177,8 @@ namespace g2 {
|
||||
}
|
||||
|
||||
|
||||
// By default this function pointer goes to \ref fatalCallToLogger;
|
||||
std::function<void(FatalMessagePtr) > g_fatal_to_g2logworker_function_ptr = fatalCallToLogger;
|
||||
// By default this function pointer goes to \ref pushFatalMessageToLogger;
|
||||
std::function<void(FatalMessagePtr) > g_fatal_to_g2logworker_function_ptr = pushFatalMessageToLogger;
|
||||
|
||||
/** The default, initial, handling to send a 'fatal' event to g2logworker
|
||||
* the caller will stay here, eternally, until the software is aborted
|
||||
|
@ -64,10 +64,26 @@ namespace g2 {
|
||||
void saveMessage(const char* message, const char* file, int line, const char* function, const LEVELS& level,
|
||||
const char* boolean_expression, int fatal_signal, const char* stack_trace);
|
||||
|
||||
// forwards the message to all sinks
|
||||
void pushMessageToLogger(LogMessagePtr log_entry);
|
||||
|
||||
|
||||
// forwards a FATAL message to all sinks,. after which the g2logworker
|
||||
// will trigger crashhandler / g2::internal::exitWithDefaultSignalHandler
|
||||
//
|
||||
// By default the "fatalCall" will forward a Fatalessageptr to this function
|
||||
// this behaviour can be changed if you set a different fatal handler through
|
||||
// "setFatalExitHandler"
|
||||
void pushFatalMessageToLogger(FatalMessagePtr message);
|
||||
|
||||
|
||||
// Save the created FatalMessage to any existing sinks and exit with
|
||||
// the originating fatal signal,. or SIGABRT if it originated from a broken contract
|
||||
// By default forwards to: pushFatalMessageToLogger, see "setFatalExitHandler" to override
|
||||
//
|
||||
// If you override it then you probably want to call "pushFatalMessageToLogger" after your
|
||||
// custom fatal handler is done. This will make sure that the fatal message the pushed
|
||||
// to sinks as well as shutting down the process
|
||||
void fatalCall(FatalMessagePtr message);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user