About this project

spdlog is a high-performance C++ logging library designed for speed, flexibility, and ease of use. It can be used as a header-only library or compiled for faster build times, requiring only a C++11 compiler. The library is built on top of the fmt formatting library, providing feature-rich output formatting with support for positional arguments, padding, alignment, and custom type formatters. Key features include synchronous and asynchronous logging modes, multi-threaded and single-threaded loggers, and a wide range of log targets such as rotating log files, daily log files, console output with color support, syslog, Windows event log, Windows debugger output, and Qt widgets. Custom sinks can be implemented to extend the library to additional targets. Log levels can be filtered at runtime or compile time, and levels can be loaded from environment variables or command-line arguments. The library supports backtrace functionality, where debug messages are stored in a ring buffer and can be dumped on demand—useful for displaying recent debug output when an error occurs. Additional utilities include periodic flushing of registered loggers, stopwatch support for timing measurements, binary data logging in hexadecimal format, mapped diagnostic context (MDC) for thread-local key-value pairs, and user-defined callbacks for log events. Custom error handlers and file open/close event handlers provide further control over logging behavior. spdlog is cross-platform, supporting Linux, FreeBSD, OpenBSD, Solaris, AIX, Windows (MSVC 2013+, Cygwin), macOS (Clang 3.5+), and Android. It is available through numerous package managers including apt, Homebrew, MacPorts, FreeBSD pkg, dnf, emerge, pacman, zypper, vcpkg, conan, conda, and build2. Benchmarks on Ubuntu 64-bit with an Intel i7-4770 CPU show synchronous single-thread throughput of approximately 5.7 million messages per second for basic logging, with asynchronous mode achieving up to 2.6 million messages per second under 10-thread contention with an overrun policy. Documentation is available in the project wiki.