mirror of
https://github.com/vgough/encfs.git
synced 2024-11-29 19:33:49 +01:00
5f0806c5cc
git-vendor-name: easylogging git-vendor-dir: vendor/github.com/muflihun/easyloggingpp git-vendor-repository: https://github.com/muflihun/easyloggingpp git-vendor-ref: master
34 lines
710 B
C++
34 lines
710 B
C++
//
|
|
// This file is part of Easylogging++ samples
|
|
//
|
|
// Custom crash handler sample to demonstrate el::Helpers::setCrashHandler
|
|
//
|
|
// Revision 1.0
|
|
// @author mkhan3189
|
|
//
|
|
|
|
#include "easylogging++.h"
|
|
|
|
INITIALIZE_EASYLOGGINGPP
|
|
|
|
void myCrashHandler(int sig) {
|
|
LOG(ERROR) << "Woops! Crashed!";
|
|
// FOLLOWING LINE IS OPTIONAL
|
|
el::Helpers::logCrashReason(sig, true);
|
|
// FOLLOWING LINE IS ABSOLUTELY NEEDED AT THE END IN ORDER TO ABORT APPLICATION
|
|
el::Helpers::crashAbort(sig);
|
|
}
|
|
|
|
int main(void) {
|
|
|
|
el::Helpers::setCrashHandler(myCrashHandler);
|
|
|
|
LOG(INFO) << "My crash handler!";
|
|
|
|
std::string* s = new std::string();
|
|
delete s;
|
|
s->clear();; // Crash!
|
|
|
|
return 0;
|
|
}
|