Releases: KjellKod/g3sinks
2.2 minor update, CI, output targets, installation and snippets
What's Changed
- windows CI update for zlib version by @KjellKod in #133
- run colored cout snippet in Windows if available by @KjellKod in #134
- Update ColorCoutSink for WIN32 by @lakor64 in #132
- Fix duplicate clean targets by @bmagistro in #136
- add option to disable installing g3sinks for projects embedding by @bmagistro in #135
- updated version to 2.2 by @KjellKod in #137
New Contributors
Full Changelog: 2.0.2...2.2
2.0.2 cmake build tiny improvement
filesystem adoption. Boost dependency is removed
What's Changed
- c++17 replaces boost dependency by @KjellKod in #124
- Code cleanup
- Added formatting help with clang-format and sublime
Full Changelog: 1.1.5...2.0.1
1.1.5 Last release that requires boost library support.
Any following release will be without requiring boost library support.
This means that apart from zlib there are no other 3rd party libraries that needs to be downloaded and installed.
Changes between 1.1.4 and 1.1.5
repository and system build changes
- Removed obsolete travis CI and replaced it with OSX/Linux CI GitActions for CI pipeline
- Updated documentation, templates for PR, issues, questions,
- Downloading gtest instead of storing it in the repo (#117, #118, #119))
- CI support Windows moved from Visual Studio 2015 to Visual Studio 2017 (#113)
- CMake set for using C++17 standard (#113)
Test improvement
- Increased test coverage for LogRotate with filter (#115)
What's Changed Described By Commits
- C++14 to C++17 by @KjellKod in #113
- Added missing unit test for LogRotateFilter - FilterTest::OverrideLogDetails by @KjellKod in #115
- bare minimum fix for #117 issue by @KjellKod in #118
- Update CMakeLists.txt (#118) by @thomasCresson in #119
- Update README.md by @KjellKod in #120
- Delete .travis.yml by @KjellKod in #121
- GitActions / CI improvements with macos by @KjellKod in #123
New Contributors
- @thomasCresson made their first contribution in #119
Full Changelog: 1.1.4...1.1.5
Last release (?) with C++14 support. From now on master will be on C++17/20
- updated build system
1.1.3 Last Version with the original CMake Build Structure
1.1.2 New Logging Sinks. Summary of changes after 1.1.1:
New Sink and Existing sink improvements
- logrotate with thread-id formatting (#53 ) @KjellKod
- example colored output improved (#59) @guzhaoyuan
- Windows tracelogging (#71) @jjhegedus
- File logger with access to open file descriptor (#81) @JoelStienlet
Build improvments
- C++14 (#54) @bmagistro
- CMake external project support (#56) @lishuai87
- Syslog CMake improvement (#77) @JoelStienlet
- Gtest dynamic download (#94) @mkilivan
Bug fix
- mktime tiny memory lead ref(#57) @lishuai87
- syslog (#79, #91) @JoelStienlet
c++11 version support (after this version g3sinks will require c++14)
Curtesy release for users that have access to c++11. From now on master and newer releases will be on c++14 with c++17 possibility.
Changes
- Update to work with improved time format in g3log
- Improved version tagging
- Added Travis Cloud CI for branch and pull request testing
logroate with Linux build (make install or make package)
Building g3sinks
Requirements
g3log
G3sinks requires g3log to be installed.
The g3log install location has to be specified during the cmake build step. In the example below the g3log installation location is /usr/local
with libraries in '/usr/local/lib' and 'headers in '/usr/local/include'
The given argument for the location would then be : 'cmake -DCMAKE_PREFIX_PATH=/usr/local/'
boost
G3sinks requires boost to be installed.
For installing boost please follow their instructions.
The boost install location BOOST_ROOT
or Boost_INCLUDE_DIR
has to be specified during the cmake build step.
In the example below the boost installation
location is /usr/local
ZLIB
The ZLIB library must be installed for the logrotate to be able to compress the old log files
in Ubuntu it can be installed with sudo apt-get install zlib1g-dev
. Please see your specific platform for details or go to the zlib page
Building with unit tests added
cd g3sinks
cd 3rdparty
unzip gtest-1.7.0.zip
cd ..
cd logrotate
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/ -DBOOST_ROOT=/usr/local -DADD_LOGROTATE_UNIT_TEST=ON ..
make -j
Executing the unit tests
./UnitTestRunneer
Installing
sudo make install
Alternative on Debian systems
make package
sudo dpkg -i g3LogRotate-<package_version>Linux.deb
G3log and Sink Usage Code Example
Example usage where a logrotate sink is added. The logrotate limit is changed from the default to instead be 10MB. The limit is changed by calling the sink handler which passes the function call through to the actual logrotate sink object.
// main.cpp
#include <g3log/g3log.hpp>
#include <g3log/logworker.h>
#include <g3sinks/logrotate.hpp>
#include <g3log/std2_make_unique.hpp>
int main(int argc, char**argv) {
using namespace g3;
std::unique_ptr<LogWorker> logworker{ LogWorker::createLogWorker() };
auto sinkHandle = logworker->addSink(std2::make_unique<LogRotate>(),
&LogRotate::save);
// initialize the logger before it can receive LOG calls
initializeLogging(logworker.get());
// You can call in a thread safe manner public functions on the logrotate sink
// The call is asynchronously executed on your custom sink.
const int k10MBInBytes = 10 * 1024 * 1024;
std::future<void> received = sinkHandle->call(&LogRotate::setMaxLogSize, k10MBInBytes);
// Run the main part of the application. This can be anything of course, in this example
// we'll call it "RunApplication". Once this call exits we are in shutdown mode
RunApplication();
// If the LogWorker is initialized then at scope exit the g3::shutDownLogging() will be
// called automatically.
//
// This is important since it protects from LOG calls from static or other entities that will go out of
// scope at a later time.
//
// It can also be called manually if for some reason your setup is different then the one highlighted in
// this example
g3::shutDownLogging();
}