Commit Graph

54 Commits

Author SHA1 Message Date
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
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
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities
a5f0158abd
speed up build (#367) by downloading gtest zip and avoiding cloning 2020-06-28 07:54:53 -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
Murat Kilivan
68f3b174d9
Use CMake to download GoogleTest as part of build (#355)
Having GoogleTest source in the project means we are likely using a stale version of test. This change is to use CMake to download GoogleTest as part of the build's configuration step.
2020-06-03 15:37:46 -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
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
Andreas Schönle
82df2168aa CMake messages changed to message( STATUS "..." ) (#190) 2017-05-17 14:31:19 -06:00
Andreas Schönle
ac37076327 Cross-compiling: Version readout fixed (#189)
* Cross-comoiling: Version readout fixed
Test.cmake: Path handling consistent

* ".x" syntax in variable checking removed

* Use G3LOG_DEBUG also in linux-specific code

* Fixed error when linux and shared library is on

* Fixed linux/windows shared lib handling: FATAL_ERROR for wrong cmake
version and no message in linux
2017-05-17 14:24:11 -06:00
Kjell Hedström
c08fba999b Definitions made explicit (#196)
* force definition inclusion

* to make it clear to the user
2017-05-17 08:25:29 -06:00
Andreas Schönle
123977f106 unit tests running with windows shared dll (#178)
* unit tests running with windows shared dll

* CMake automatically uses DLL runtime - remove cmake entries modifying
compiler flags

* missing DBUG vs DEBUG issue in Linux

* generated header added

* correction in CMake: Set HEADER_FILES correctly

* added static library option

* switched to powershell and included WORKING_DIRECTORY

* powershell use in windows and WORKING_DIRECTORY instead of cd

* Fixed appveyor.yml to use Release configuration and run unit tests

* trying to make appveyor work again ...

* make sure ERRORLEVEL is 0 when unit tests run successfully

* Still trying to fix appveyor ...

* Defaulting to shared library in linux, too

* Removed runtime loading test when g3log is not a shared library in linux

* Run unit tests verbosly using ctest.exe

* Disabled AggressiveThreadCallsDuringShutdown test

* Revert "Run unit tests verbosly using ctest.exe" (accidental commit)

This reverts commit b30513450d.

* re-committing valid parts of reverted commit

* DBUG vs DEBUG fix moved to generated_definitions.hpp

* cleanup shared/static option

* clarify cmake build types regardless of type

* Added compile test for DEBUG and DBUG

* put back formatting

* Removed commented out /MD switches for MSVC
2017-05-09 10:26:48 -06:00
Kjell Hedström
887673f4d0 Time adjustments for VMs and 32-bit embedded (#177)
* in progress. now using std::chrono

* in progress, not working but defined how to fix it - broken unit tests

* working - verified on VM. Unit tests not yet updated accordintly

* fixed all tests

* fixed formatting

* adjusted timezone during testing

* adjusted test for timezone
2017-04-27 22:57:04 -06:00
Kjell Hedström
e04681ac42 Levels api changes 2 (#170)
* in progress

* Update loglevels.hpp

* Update loglevels.hpp

* don't code when too tired

* revert back

* removed comment
2017-04-05 23:03:55 -06:00
Kjell Hedström
33ed100f91 Colorer build and loglevel improvements (#161)
* static build with MS libs; remove vc11 support from cmake
* support AMD processor on winXp
* mingw build
* support older versions
* removed cmake warnings

* fix cmake >= 3.1 warnings (CMP0054)
* add target_include_directories - in projects that depend on g3log, do not need to specify include_directories
* Improved CPackage installation
* cleanup of build and test scripts
* c++14 gives for cleaner syntax
* build cleanup libg3logger.so will be a link to the actual libg3logger.so.<major><minor><build>. Only shared libraries from now on



* disableAll for log levels
* new setLogLevel impl
* cleaned up levels, now it should be easy for the user to understand how to add custom levels
2017-03-30 22:52:09 -06:00
Kjell Hedström
9b17525b97 Improved the cpackage build. Also removed test compilation warnings (#156) 2017-03-26 01:11:18 -06:00
Andreas Schönle
4bd1870a76 effectively remove feature - it is almost useless. Keep the change to the unit test avoiding premature exit when fatal signal handling is not enabled in the library 2016-12-06 13:55:47 +01:00
SchoenleAndi
7d1481724c restore needs a flag to remove custom levels (at least the tests need to be able to do it)
addLogLevel again resets the log level to the passed enable_state as even requesting the level before adding it would otherwise lead to unexpectedly not setting a "new" level to the passed state. We now assume setLogLevel is not called before addLogLevel without considering this behavior.
2016-12-05 11:12:28 +01:00
SchoenleAndi
a98b91fc5c ensure that raise(SIGTERM) is not called in test if g3log was compiled without fatal signal handler 2016-12-05 10:48:52 +01:00
SchoenleAndi
940d11a61d DBUG vs DEBUG fixed in unit test, too 2016-10-19 13:36:19 +02:00
Kjell Hedström
86473c60e0 Gimesketvirtadien's time requested changes (#104)
* Added "removeSink" method and related functionality to LogWorker API

* Added a new API for plugging in custom Timestamp generator.

* Revert "Added "removeSink" method and related functionality to LogWorker API"

This reverts commit c9cee5d9a0.

* Dropping shared_ptr<Timestamp> in log messages and using regular vars

* Moving to standard timespec struct from custom Timestamp

* Wiring timespec timestamps with formating routine

* Falling back to clock_gettime

* Reverting g3 API changes

* Optimizing format string generation

* Removed _microseconds from LogMessage

* Implemented sec fractional format key

* Optimization of format string generation

* Adjusting comments

* Refining localtime_formatted by introducing two helper functions

* refactored and simplified code

* fixed up some commented away unit tests

* refactoring message specifics tests to it's own test

* Use gcc 4.9

* C++14 for Linux

* Update .travis.yml

* Update buildAndRunTests.sh

* lower case in `-std=c++14`

* -lrt flag for gcc

* Added support for high precision clock on Linux/gcc (already there now for OSX). Windows is still missing

* intermediate comments

* Clarified for some code readers the mysterious use of assert in an expression that is always true

* refactored + renamed functions and constants. Added unit test for retrieving fractional type

* committing changes previously fixed - finished unit testing for g3::internal::time::GetFractional(..)

* added unit test for fractional to string

* added missing unit tests for localtime_formatted

* fixed? nano / microsec functionality to timer

* test
2016-08-11 00:27:52 -06:00
Kjell Hedström
04817b6e85 Workaround for windows testing (#100) 2016-06-12 16:58:14 -06:00
Kjell Hedstrom
8df4eadd92 removed false positives as detected by Checkmarx code analysis tool. Not impressed so far though with the tool 2016-03-18 10:50:59 -06:00
Kjell Hedsröm
fbddb5a5ca added new API for AddDefaultLogger to API 2016-02-17 00:25:55 -07:00
Kjell Hedsröm
b7704b1ed7 fixed merge conflict 2016-02-17 00:06:45 -07:00
Kjell Hedsröm
072a7bef93 put back commented out code 2016-02-16 22:57:02 -07:00
Kjell Hedsröm
fb034e1000 fixed commented out code, left it but corrected 2016-02-16 22:56:21 -07:00
Kjell Hedsröm
a0b961ee04 Allow parenthesis in path and filename 2016-02-16 22:52:38 -07:00
Jiri Hoogland
3aab24d8c8 Handle empty logger_id 2016-01-28 10:06:40 -05:00
Jiri Hoogland
31c01b168c Add ability for user to override 'g3log' monniker in log file 2016-01-28 10:02:22 -05:00
Jiri Hoogland
d9bc515ce8 Add ability for user to override 'g3log' monniker in log file 2016-01-27 18:51:02 -05:00
Kjell Hedsröm
d4d60ca517 Fixed dynamic logging unit testw: 2015-11-23 23:49:27 -07:00
Kjell Hedstrom
09a9bcc95e compile warnings, gtest comparisons 2015-09-21 15:33:34 -06:00
Craig Cogdill
051fb50c98 Adding the function name and saving the day 2015-09-16 16:29:48 -06:00
Kjell Hedstrom
d936bc2763 Fixed formatting unit tests 2015-09-14 21:52:42 -06:00
Kjell Hedstrom
fae01d5e92 Added missing test for custom signal handling for SIGTERM 2015-09-11 02:49:17 -06:00
Kjell Hedstrom
1803498e89 Breaking change but a good change: Cleared up the API for Creating log worker and Adding sinks 2015-08-19 10:08:41 -06:00
Kjell Hedstrom
8dfe9e0716 Improved copy constructors and assignment operator which is needed now when LOGLEVELS can be made on the fly 2015-08-12 06:43:24 -06:00
Kjell Hedstrom
49aee72faf improved comparison test 2015-08-04 07:44:39 -06:00
Kjell Hedstrom
13cc398f06 comparison operators for level: gtest, std::find, == operator, !=operator 2015-08-04 07:43:38 -06:00
Kjell Hedstrom
d5ad2709a7 removed changes to g3::only_change_at_initialization at shutdown/init.
It is thread unsafe and should be done explicitly (also the threaded 100 threads calling with initialzation + shutdown was handing)... good test
2015-07-20 08:11:57 -06:00
Kjell Hedstrom
786b92a6d1 Another, tiny, breaking change.
Due to popular request I have added the possibility to put in your own custom log levels. Due to performance regards changes to the log levels should ONLY be done
in a single thread context (initialiation) for that reason the namespace
used to "setLogLevel" is named appropriately
i.e. use: g3::only_change_at_initialization::setLogLevel(...)
2015-07-20 08:00:33 -06:00
Kjell Hedstrom
c4f9463b6b Custom levels can be added: So far dynamic on-off does not work 2015-07-20 00:45:41 -06:00
Kjell Hedstrom
7c7012325d Easier to install. continues
1) Breaking change:  g3 namespace replaces g2
2) g2log.hpp remains in src/g2log.hpp... but now all it does is to include the g3log.hpp, etc
3) ALL HEADER FILES ARE IN src/g3log/  while all .cpp and .ipp files are in /src  (exception for g2log.hpp)
   This should make it EASIER for clients to copy/install the header files to the new location.  It greatly simplifies
   rpm and cpackage installationsw
2015-07-19 23:10:56 -06:00
Kjell Hedstrom
6750efe8fe g2log.hpp is kept as a helper include. It will pull in the most frequent include files
All other are under g3log. Example: #include <g3log/time.hpp> #include <g3log/g3log.hpp> etc
This makes sure that the package manager (to be  used soon) does NOT clutter any /usr/local/include space
instead all the includes will be in /usr/local/include/g3log (or similar)
2015-07-16 01:55:23 -06:00
Kjell Hedstrom
78103cb415 Auto generate macro defintions in a file. This way you don't have to re-state them in your library
if no options are given a blank file will be generated
2015-07-13 07:49:44 -06:00
Kjell Hedstrom
cc5cf169ba After code review by Kamil.
Moved internal API to public API.
g2log.hpp/cpp   g2::setFatalPreLoggingHook(...) and g2::setFatalExitHandler(...)
2015-02-23 23:29:02 -07:00
Kjell Hedstrom
a69eb201a1 Pre-fatal-log hook for usage before the fata log is sent to sinks 2015-02-22 23:31:17 -07:00