Small changes, essentially cleanup, with no actual code logic change.
* Ensure symbol_buffer aligned same as SYMBOL_INFO
* Use constexpr for compile-time constant
* Use = default for ctor bodies to allow compiler optimize them
* Pass string by reference to prevent copying, other smaller types we can avoid passing by reference as the type is cheaper to copy.
Usage of C++20's new constexpr functionalities for easier usage of custom LEVELS!
Modified:
* With C++20 LEVELS's constructor can have a constexpr specifier
* const LEVELS can be replaced to be constexpr's instead
Improvement for Docker run C++ applications with g3log
* This addresses the case when a PID1 process crashes and the signal handling, goes into multiple or even infinite loops due to subsequent crashes. The PR makes sure to restore all signal handlers to the original signal handling after the first crash is detected. For
* Fix FileSink dropping messages introduced by 'optionable buffer to x messages' feature
Commit 6c6122fafc introduced a bug where 99 out of 100 logs were actually dumped
* Updated unit tests to trigger sink flush bug
---------
Co-authored-by: Ryan Ammoury <ryan.ammoury@squadrone-system.com>
* __SIGFUNC__ no longer default for Windows, It has to be explicitly picked through CMAKE option
* __PRETTY_FUNCTION__ no longer default for gcc/clang, It has to be explicitly picked through CMAKE option
raise() system call does the same as kill() system call in a
single-threaded program.
In a multithreaded program, it does the same as pthread_kill() which
ensures that if the signal causes a handler to be called, raise() will
return only after the signal handler has returned.
When running with additional warnings enabled, a couple lambdas produce
a warning that they should be declared with noexcept. This addresses the
lambdas that had been identified while building.
Signed-off-by: Ben Magistro <koncept1@gmail.com>
* It is confusing to name the target g3logger. KISS --> g3log. This MIGHT break installations for some but it's a needed correction.
* Updated version number to 2.1.x
The LOG and LOGF macros had been modified to be statement-safe, but the
LOG_IF, CHECK, LOGF_IF, CHECKF, and CHECK_F macros were all still
unsafe in face of code where single-statement blocks were not enclosed
in {}.
For example code like this:
if (!foobar)
CHECKF(goodness, "badness detected!");
else
handle_foobar(foobar);
would fail in subtle and possibly dangerous ways.
Fix this by combining multiple if-statements into a single conditional
and inverting the conditions, then adding an empty then-block and moving
the log statement to the else-block.
* restore original sigaction in restoreSignalHandler
- Save original sigactions in a map called gSavedSigActions
- In restoreSignalHandler, do nothing if there is no saved sigaction.
If there is a saved sigaction, then re-install it.
- Fixes issue #253
* fix bug found in code review of PR #254
* add functions for reporting sigaction errors
- Factor out reportSigactionError functions from functions that
call sigaction to allow unit testing.
- Use strsignal libc function to convert from signal number to name
to eliminate chance of not finding the name in {g,k}Signals maps.
* cleanup. perror doesn't need a wrapper. put code under test
* Added thread ID configurable through API calls. Left to do g3sinks, documentation and some corner test cases for CHECK, LOG(FATAL) and FATAL signal
* improve test script, break if error
* easier to use API. Api docs added
* Update API.markdown
* Update API.markdown
* Update API.markdown
* updated readme with details for overriding default for "full details"
* updated custom sink with custom formatting example