spdlog
by
gabime

Description: Fast C++ logging library.

View gabime/spdlog on GitHub ↗

Summary Information

Updated 49 minutes ago
Added to GitGenius on March 16th, 2026
Created on November 1st, 2014
Open Issues/Pull Requests: 45 (-5)
Number of forks: 5,115
Total Stargazers: 28,632 (+1)
Total Subscribers: 445 (+0)

Detailed Description

The `gabime/spdlog` repository provides a high-performance C++ logging library designed for speed and flexibility. Its primary purpose is to offer a robust and efficient solution for incorporating logging capabilities into C++ applications, enabling developers to track events, debug code, and monitor application behavior. The library is built to be fast, making it suitable for performance-critical applications where logging overhead needs to be minimized.

The core functionality of `spdlog` revolves around its logging capabilities. It supports various log levels (trace, debug, info, warn, error, critical, and off), allowing developers to control the verbosity of their logs. The library offers both synchronous and asynchronous logging modes. The asynchronous mode is particularly beneficial for applications where performance is paramount, as it offloads the logging operations to a separate thread, preventing them from blocking the main application thread.

A key feature of `spdlog` is its rich formatting capabilities, leveraging the `fmt` library for flexible and efficient string formatting. This allows developers to create highly customized log messages, including support for positional arguments, padding, and various data types. The library also supports custom formatting through user-defined formatters.

`spdlog` offers a wide range of log targets, or "sinks," where log messages can be directed. These include standard output (with color support), files (rotating and daily), syslog, Windows event log, Windows debugger, and even Qt widgets. The rotating file sink allows for automatic file rotation based on size or time, preventing log files from growing indefinitely. The daily file sink creates new log files each day at a specified time. The library is also easily extendable, allowing developers to create custom sinks to direct logs to other destinations.

The library is designed to be highly configurable. Log levels can be set globally or per logger, and can be modified at runtime. It supports loading log levels from command-line arguments or environment variables, making it easy to control logging behavior without recompiling the application. `spdlog` also provides support for backtraces, allowing developers to store debug messages in a ring buffer and display them on demand, which is useful for debugging complex issues.

Installation is straightforward, with options for both header-only and compiled versions. The header-only version is convenient for quick integration, while the compiled version generally offers faster compile times. The repository provides clear instructions for building and using the library, along with example code snippets demonstrating various features. Package managers like Debian, Homebrew, MacPorts, and others offer pre-built packages, simplifying the installation process.

The repository includes comprehensive documentation in the form of a wiki, covering various aspects of the library, including usage examples, configuration options, and advanced features. The benchmarks provided in the README highlight the library's performance, demonstrating its speed compared to other logging solutions. The library also supports features like periodic flushing, stopwatch functionality, logging binary data in hex, multi-sink configurations (allowing different formats and log levels for different sinks), user-defined callbacks for log events, and mapped diagnostic context (MDC) for adding contextual information to log messages. The library also supports custom error handlers and file open/close event handlers. Overall, `spdlog` is a powerful and versatile logging library that provides a comprehensive set of features for C++ developers.

spdlog
by
gabimegabime/spdlog

Repository Details

Fetching additional details & charts...