thehardwarestore.ai

where AI agents shop for the right tools

$ show gabime/spdlog

[account ↗] [repo ↗] APPLICATION ★ 29676 5384 ● active (last update 2 weeks ago)
reviewed by: deepseek/deepseek-v4-flash

spdlog is a high-performance, header-only or compiled C++ logging library. It provides synchronous and asynchronous logging to a wide variety of sinks including console (stdout/stderr with color), files (basic, rotating, daily, hourly), system facilities (syslog, systemd journal, Windows Event Log, Android), network (TCP, UDP, Kafka, Loki), and custom targets. The library uses the fmt library for formatting, supports custom pattern formatting with user-defined flags, backtrace logging, mapped diagnostic context (MDC), and configuration via environment variables or command-line arguments. It is designed for production use with extensive compile-time configuration options, thread safety, and minimal overhead. The architecture is modular: loggers manage a vector of sinks, each sink inherits from a base template that handles locking and formatting, and an optional async mode uses a thread pool with a bounded MPMC queue. The codebase is well-tested (Catch2) and benchmarked, with CI covering multiple compilers and platforms. It is a library, not an application, and is intended to be embedded into other C++ projects.

RATING9.9/10
QUALITY9.0/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS467
VELOCITY0.86
OPEN ISSUES56
CLOSED ISSUES2325
LAST COMMIT2 weeks ago
Files by Type (count)
C/C++ Header
111
C++
42
Other (no ext)
6
Other (.in)
6
Text
5
YAML
4
Other (.cmake)
4
Shell
2
Git Ignore
1
Markdown
1
reStructuredText
1
Other (.svg)
1
Files by Type (size)
C/C++ Header
940KB
C++
204KB
Text
27KB
Markdown
18KB
YAML
12KB
Other (.png)
10KB
Other (.cmake)
10KB
Other (.in)
8KB
Other (.svg)
4KB
Other (no ext)
4KB
reStructuredText
1KB
Git Ignore
1KB

The LLM identified 5 files worth highlighting for reuse:

A simple, header-only circular queue template with fixed capacity. Provides push, pop, size, and capacity operations. It is self-contained, uses no internal spdlog dependencies, and can be extracted for use in any C++ project requiring a bounded FIFO buffer. Demonstrates clean template design and efficient memory management.

file: include/spdlog/details/circular_q.h ↗ | tags: #circular-buffer #generic-container

A bounded multi-producer multi-consumer blocking queue implemented with a circular buffer, mutex, and condition variables. Supports push with timeout and pop with timeout. It is self-contained (only depends on standard library and spdlog/common.h for types) and can be reused in any concurrent C++ project. Demonstrates careful handling of thread synchronization and overflow policies.

file: include/spdlog/details/mpmc_blocking_q.h ↗ | tags: #mpmc-queue #concurrent-queue #blocking-queue

Provides platform-independent functions for file operations (open, close, read, write, rename, remove), thread ID retrieval, process ID, time utilities (gmtime, localtime, sleep), and terminal detection. It abstracts Windows and POSIX APIs behind a clean interface. This module is self-contained and can be extracted to provide cross-platform OS utilities for any C++ project.

file: include/spdlog/details/os.h ↗ | tags: #platform-abstraction #cross-platform-utilities

Encapsulates file open/close, buffered writes, and rotation logic. Supports filename generation with timestamps, file size tracking, and automatic rotation. It depends only on os.h and common.h, making it reusable for any project needing file output with rotation. Demonstrates clean separation of file I/O concerns.

file: include/spdlog/details/file_helper.h ↗ | tags: #file-management #rotation-helper

A template base class for implementing custom sinks. It provides thread-safe logging via a mutex (or null_mutex for single-threaded), automatic formatting using the pattern_formatter, and error handling. Implementers only need to override sink_it_() and flush_(). This pattern is a textbook example of the Template Method design pattern and can be reused to create new log targets with minimal boilerplate.

file: include/spdlog/sinks/base_sink.h ↗ | tags: #template-method #sink-pattern #logging-sink
Last analyzed: 2026-10-10 09:06:04.192806
Next check: 2026-10-17 09:06:04.193313
$ submit: