Releases: KjellKod/g3log
Improved platform support: FreeBSD, Windows, Linux, OSX
Nothing major but it's a good point to call a new g3log release, 1.2, since we have some nice improvement to fatal handling, default logging as well as improved platform support on FreeBSD, Windows, Linux and OSX.
On Linux we now also have the possibility to do 'make package'. On OSX installation can be done with 'brew install g3log'.
Summary of changes since 1.1:
March
Fixed CPackage to work for Linux. Thanks to Hans Duedal #83
FYI: OSX users can now use ‘brew install g3log’
February
Possiblity to override the default ‘g3log’ adding to the file name for the default file logger. Thanks to jkhoogland, pull request #82, issue: ##75
Allowed parenthesis in filename paths. pull request #81, issue ##31
Improved Linux Clang support, pull request: #77
January
cleanup code, removed unused includes: #72
December
API cleanup. pull request: #66 thanks to Lu Guanqun
Windows build support, adding debug symbols, pull request #65 thanks to Christos cstamatopoulos\
November
fixed Windows compilation issue with atomic, pull request: #63 thanks to Christos Cstamatopoulos
Improved API documentation Readme.markdown and API.markdown, pull requests: #64, #54
default logger will flush after every log entry written. (see github.com/KjellKod/g3sinks for other ways of handling log writing), pull request: #58
CHECK_F and CHECKF exists. CHECK_F is kept for backwards compatiability.
improved testing for dynamic logging levels
October 2015
removed warnings for gcc5, pull request: #55
Added API.markdown to explain in more detail the g3log API
suppress 'thread attribute directive ignored' warning on mingw (thands to Turenar )
September 2015
Override of signal handler (especially useful for zmq users who need this for overriding SIGTERM, pull request #48
default log formatting improved. pull request #52, #50, thanks to Craig Cogdill
<date and time> <file>:L<line>
to
<date and time> <file>-><function>:<line>
,
Support for FreeBSD, pull request #53,. thanks to Robert Ayrapetyan.
1000 deaths handling + much improved sink support
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);
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);