Commit Graph

157 Commits

Author SHA1 Message Date
CryptoManiac
7817fd3a94
Update loglevels.hpp (#496) 2023-05-20 07:16:32 -06:00
Dmitry Tsarevich
bad9c58e60
Fix found by PVS-Studio issues (#490)
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.
2023-05-15 07:59:44 -06:00
SzGaa
cc0fb7c1ea
constexpr LEVELS for easier custom level usage (#483)
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
2023-05-03 21:50:48 -06:00
GergoTot
5323480780
Avoid pending of containerized applications in case of aborting (#481)
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
2023-03-07 17:30:58 -07:00
Kjell Hedström
4f1224b9d5
Fix filesink drop messages improved (#479)
* 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>
2023-02-20 06:16:34 -07:00
Grzegorz Głowacki
09317e3573
Parse OSX stack dump format in order to demangle it correctly (#473)
* Parse OSX format  mangled stack trace correctly
Co-authored-by: Grzegorz Glowacki <grzegorz.glowacki@avid.com>
2023-02-04 04:40:56 -07:00
Kjell Hedström
6c6122fafc
optionable to buffer x messages before writing to file, default to 100 which will really boost performance (#471) 2022-12-08 22:08:28 -07:00
Kjell Hedström
dbd3d74a39
__SIGFUNC__ no longer default for Windows. __PRETTY__FUNCTION no longer default for gcc/clang (#470)
* __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
2022-11-29 22:16:35 -07:00
Kjell Hedström
881e6da439
__func__ doesn't make sense (#469)
__func__ doesn't make sense since we have left c++11 in the dust
2022-11-29 09:00:46 -07:00
ablangy
0c09462e4d
exitWithDefaultSignalHandler() should block until signal handler returns (#464)
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.
2022-11-10 09:34:07 -07:00
bmagistro
ed91b899f0
Resolve noexcept warnings on lambdas (#463)
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>
2022-09-14 14:04:34 -06:00
DlubalSmidJaroslav
a7192f2b1c
Fixes #428: memory leak in g3::internal::createLogFile (#430)
Co-authored-by: Jaroslav Smid <smidjar2.reg@email.cz>
2022-01-10 20:49:59 -07:00
landwehrj
9bb36eb7e5
Fix pretty function magic constant overwriting (#424)
* Fix bug with __PRETTY_FUNCTION__ being always overwritten.

* Fix unit test to reflect new pretty function.
2021-12-19 20:45:12 -07:00
Szekely Gyorgy
c51128f051
Unblock faulting thread signal handler after log flush is complete (#419) 2021-11-22 08:39:53 -07:00
Chad Engler
d3f2d11ae6
Fix ARM compilation for windows. (#401) 2021-04-07 21:33:40 -06:00
lukeocamden
61f3f6e3db
Avoid copying LOGLEVELS for g3::logLevel call (#399)
* Avoid copy-constructing LEVELS for logLevel call
2021-01-26 12:49:10 -07:00
FriendlyFire
e28f559d32
C++20 compatability -- std::result_of with std::invoke_result (#392)
* Replaced result_of with invoke_result_t.
* Fixed a few compile errors and updated CMakeLists.
* Updated Cloud CI
2020-12-16 06:51:26 -07:00
Alvin
2fca06ff6d
Fix compiler warnings and condition check improvements (#390)
* fix compiler warnings

- loglevels.cpp - warns about double return if dynamic logging is on

- crash handler_unix.cpp - warns about unused variable
2020-11-23 21:23:13 -07:00
Alvin
c0ae589024
Alvin/minor fixes and improvements (#389)
* Fix typos
* Fix build for MinGW
- MinGW g++ doesn't recoganize `-rdynamic`
2020-11-17 20:40:26 -07:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
a4abb8b521
Update loglevels.hpp 2020-08-07 10:22:18 -06:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
c2b1ff6475
Update loglevels.hpp 2020-08-05 12:30:09 -06:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
e55c270753
Update loglevels.hpp 2020-08-05 12:28:17 -06:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
b93e96ebf7
Update loglevels.hpp 2020-08-05 12:27:05 -06:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
69a0be4c9c
play/tryout: It is confusing to name the target g3logger. KISS --> g3log (#372)
* 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
2020-07-08 22:42:55 -06:00
shiyuge
8e79dd6554
bug fix: vsnprintf_s return value 0 isn't error (#373)
Conforming with vsnprintf_s
2020-07-06 21:21:28 -06:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
cdceb28deb
Update logworker.hpp (#369) 2020-06-29 11:58:01 -06:00
shiyuge
e639f6d800
fix typo in logworker.hpp (#365) 2020-06-24 07:31:26 -06:00
shiyuge
2206cea309
fix typo in shared_queue.hpp exampel -> example (#363) 2020-06-23 06:53:33 -06:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
5ef196eed5
Manual addition of sink removal functionality from C++11 branch (#361)
* Added sink removal
* improved build script
2020-06-19 13:49:30 -06:00
Roman Popov
751330bb41
Allow throwing from exit handler (#349)
For example for unit testing purposes we may want to replace SIGABRT with
throwing an exception, so that unit tests for CHECK()s can be written.
2020-05-08 20:13:25 -06:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
aab25a4091
one more comment fix 2020-05-08 14:33:50 -06:00
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
62162e8613
updated code comments since SIGABRT is used with default fatal handler instead of a throw 2020-05-08 14:30:52 -06:00
JoelStienlet
4000c5c899
remove std::move in return : std::future can only be moved anyway (#336)
Co-authored-by: Joel Stienlet <stienlet@localhost.localdomain>
2020-03-06 07:55:36 -07:00
Nicholas Lederer
9fb3e61e89
fix issue with stacktrace_windows not allocating sufficient memory for SYMBOL_INFO struct (#334) 2020-02-25 07:15:09 -07:00
Paul Smith
f149179178 Ensure LOG* and CHECK* macros are statement-safe (#320)
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.
2019-07-28 16:07:16 -06:00
Aleksey Dobrunov
1a010de2f6 Mingw parse error (#293)
* fix 'Failure to successfully parse the message' on mingw

* removed redundant checks
2019-01-15 12:27:53 -07:00
Christos
cf36852238 Wrap gnu::format around #if to avoid msvc warnings (#291)
* Wrap gnu::format around #if to avoid msvc warnings

* Fix compilation issue
2018-12-17 20:08:02 -07:00
Nils Gladitz
048b23d38c Use C++11 generic attribute syntax to avoid issue #282 (#283) 2018-11-19 15:25:14 -07:00
ccvca
39526ce9d2 Fix: VS 2015 logmessage.cpp(167): error C2437: "_file" already initialized (#277) 2018-07-13 05:59:11 -06:00
outkontroll
a6788f89be VS2013 missing include (#273) 2018-06-21 15:39:26 -06:00
Andreas Schönle
7b0414f76f Use defective stlpatch_future.hpp only for VS2013 (#266) 2018-05-14 06:43:05 -06:00
John Farrier
69f21e3513 Fixed ambiguous constructor error. (#262) 2018-04-26 20:30:26 -06:00
DerekJuba-NIST
7f25b004cf Update loglevels.hpp (#259)
Fixed typo DEBUG -> DBUG
2018-04-12 09:55:42 -06:00
Jeff Ebert
408061280f restore original sigaction in restoreSignalHandler (#254)
* 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
2018-03-25 21:43:49 -06:00
Kjell Hedström
14db37ad23
G3log placeholder thread ID formatting (#248)
* 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
2018-03-08 09:16:12 -07:00
Kjell Hedström
f2b860a2b4
Addressing the std2 concern raised in https://github.com/KjellKod/g3log/issues/212 (#246) 2018-02-20 22:02:19 -07:00
maj-tom
0ddfd6dccc Fix dangling else in LOG and LOGF macros (#231)
* Fix dangling else in LOG and LOGF macros
Closes #224

* added unit test
2017-12-06 21:31:55 -07:00
PeasantCodeFarmer
e7d3b9d7b1 Comment change for issue #232 (#237)
* Fixing some English/typos and a cyclical header include.

* Comment fix for issue# 232
2017-12-04 18:24:55 -07:00
PeasantCodeFarmer
b4be5a0f00 Fixing some English/typos and a cyclical header include. (#234) 2017-11-22 07:41:35 -07:00
Matt Patterson
b3cb1ba057 atomicbool.hpp needs EOF outside of comment to build on VS15 (#229) 2017-10-26 18:37:37 -06:00