G3log v1.1 Release Notes
Release Date: 2015-09-10 // over 8 years ago-
With this release g3log will:
1) Gracefully handle aggressive crashing scenarios: Imagine hundreds or throusands of threads starting up and all racing to do a SIGSEGV crash? (On v1.0 that worked fine for Linux/Gcc but for OSX/Clang it did not work well. And the exit of the process could be delayed a very long time)
2) Improved sink construction and logger initialization API. See example a,b,c below
a. Create a logger
👷std::unique_ptr<LogWorker> logworker{ LogWorker::createLogWorker() }
b) Add of custom sinks (here named "CustomSink")
auto sinkHandle = logworker->addSink(std2::make_unique<CustomSink>(), &CustomSink::ReceiveLogMessage);
0️⃣ c) Add a default file logging sink (more sinks are available at g3sinks)
auto handle= worker->addDefaultLogger(prefix, path_to_log_file);
🌲 3) Custom logging levels can be created. Please see g3log/loglevels.hpp for the value ranges
🌲 The example will create a logging level "HEY".const LEVELS HEY {WARNING.value + 1, {"Hey There"}}; LOG(HEY) << "Hello"
4) A custom pre death hook can be put in place to do custom actions when a fatal event is caught.
This should be set after the initialization of the logger (the initialization will otherwise clear it)// example showing a simple LOG(INFO) call but it could really be anything // After the hook is called it will be cleared so it can only be called once // if you need multiple "death cleanup" calls then the best is to bundle them within the allowed callback namespace { void Ooops() { LOG(INFO) << "Death is imminent"; } } // namespace .... elsewhere in the code g3::setFatalPreLoggingHook(&Ooops);