spdlog is a C++ logging library built for speed, with either a header-only or compiled setup. It targets C++ developers who need fast, formatted logging in applications ranging from small tools to multi-threaded services, without pulling in a heavyweight logging framework.
It uses the fmt library for formatting, which means log calls support positional args, padding, hex/octal/binary output, and custom formatters for user-defined types. Logging can be synchronous or asynchronous, and log levels can be toggled at compile time or runtime, including loading them from environment variables or argv.
fmt::formatter.SPDLOG_ACTIVE_LEVEL.spdlog fits any C++11+ project that needs structured, fast logging without adopting a large framework: CLI tools, servers, game engines, embedded-adjacent applications, and libraries that want to expose logging hooks to consumers. It's a good fit when you need multiple output targets (console + rotating file + syslog) with per-sink formatting and levels, or when you need async logging so log writes don't block hot paths.
It's also useful for debugging workflows where you want to keep a ring buffer of recent debug messages and only dump them when an error condition triggers, avoiding noisy always-on debug logging.
It is not the right choice if you need built-in structured logging (JSON-first) as the primary output format, centralized log aggregation/shipping, or a logging solution for non-C++ codebases. If your project targets pre-C++11 compilers, spdlog won't work since it requires C++11 at minimum. For projects that want zero third-party dependency exposure, note that spdlog pulls in the fmt library (bundled or external).
Header-only version: copy the include/spdlog folder into your build tree and compile with a C++11-capable compiler.
Compiled version (recommended for faster compile times):
$ git clone https://github.com/gabime/spdlog.git
$ cd spdlog && mkdir build && cd build
$ cmake .. && cmake --build .
See the example CMakeLists.txt in the example folder for integration details.
Package managers:
# Debian
sudo apt install libspdlog-dev
# Homebrew
brew install spdlog
# vcpkg
vcpkg install spdlog
# conan
conan install --requires=spdlog/[*]
# conda
conda install -c conda-forge spdlog
Other supported package managers include MacPorts, FreeBSD pkg, Fedora dnf, Gentoo emerge, Arch pacman, openSUSE zypper, ALT Linux apt-get, and build2.
Basic usage after install:
#include "spdlog/spdlog.h"
int main() {
spdlog::info("Welcome to spdlog!");
spdlog::error("Some error message with arg: {}", 1);
}