Manage C++ logging with speed and flexibility
When you need to record events during program execution quickly and accurately, this library handles the task. It operates on the C++11 standard and supports two usage methods: copying header files or using a compiled form. You can adjust where and how logs are written to suit your situation, making management easier even in complex systems.
Diverse output targets and fine-grained control
Beyond simple console output, the library provides a rotation feature that automatically splits files based on file size or date. It can send records to various platforms and tools, including Windows Event Log, syslog, Android Log, and Qt widgets. You can set log levels and formats independently for each output target, allowing for fine-grained control such as showing only warnings on the console while saving detailed information to a file. Additionally, you can use custom callbacks to send email notifications or perform other tasks whenever a log is recorded.
Special features for performance and debugging
It supports both synchronous and asynchronous modes to ensure that logging tasks do not slow down the main process. In asynchronous mode, you can configure the message queue size and overflow policy. For debugging, it offers a backtrace feature that stores recent debug messages in a ring buffer and outputs them all at once when an error occurs. This is useful when you do not want to leave debug logs normally but need to check specific information only when a problem arises.
Installation and platform support
It supports major platforms such as Linux, FreeBSD, OpenBSD, Solaris, AIX, Windows, macOS, and Android. The header-only version is ready to use immediately if you copy the include folder to your build tree and have a C++11 compiler. The compiled version is built via CMake, with the advantage of reducing compile time. It can be installed through various package managers, including Debian, Homebrew, MacPorts, FreeBSD, Fedora, Gentoo, Arch Linux, openSUSE, ALT Linux, vcpkg, conan, conda, and build2. Windows requires msvc 2013 or later, and macOS requires clang 3.5 or later.
Performance figures and pre-use considerations
These are measurements from a specific hardware environment, so you should perform your own benchmarks to verify them in your actual deployment environment. Note that asynchronous mode and the MDC (Mapped Diagnostic Context) feature rely on thread-local storage, meaning MDC cannot be used in asynchronous mode. Also, while log levels can be changed at runtime, compile-time levels work by removing the corresponding calls in release code, so you should understand this difference when configuring them.