Quill
Asynchronous Low Latency C++ Logging Library
Install / Use
/learn @odygrd/QuillREADME
🧭 Table of Contents
✨ Introduction
Quill is a high-performance asynchronous logging library written in C++. It is designed for low-latency, performance-critical applications where every microsecond counts.
- Performance-Focused: Quill consistently outperforms many popular logging libraries.
- Feature-Rich: Packed with advanced features to meet diverse logging needs.
- Battle-Tested: Proven in demanding production environments. Extensively tested with sanitizers (ASan, UBSan, LSan) and fuzzed across a wide range of inputs.
- Extensive Documentation: Comprehensive guides and examples available.
- Community-Driven: Open to contributions, feedback, and feature requests.
Try it on Compiler Explorer
⏩ Quick Start
Getting started is easy and straightforward. Follow these steps to integrate the library into your project:
Installation
You can install Quill using the package manager of your choice:
| Package Manager | Installation Command |
|:---------------:|:----------------------------------------------:|
| vcpkg | vcpkg install quill |
| Conan | conan install quill |
| Homebrew | brew install quill |
| Meson WrapDB | meson wrap install quill |
| Conda | conda install -c conda-forge quill |
| Bzlmod | bazel_dep(name = "quill", version = "x.y.z") |
| xmake | xrepo install quill |
| nix | nix-shell -p quill-log |
| build2 | libquill |
Setup
Quickest Setup
For the quickest and simplest setup use simple_logger():
#include "quill/SimpleSetup.h"
#include "quill/LogFunctions.h"
int main()
{
// log to the console
auto* logger = quill::simple_logger();
quill::info(logger, "Hello from {}!", "Quill");
// log to a file
auto* logger2 = quill::simple_logger("test.log");
quill::warning(logger2, "This message goes to a file");
}
Detailed Setup
For more detailed control and configuration options, use the Backend and Frontend APIs:
#include "quill/Backend.h"
#include "quill/Frontend.h"
#include "quill/LogMacros.h"
#include "quill/Logger.h"
#include "quill/sinks/ConsoleSink.h"
#include <string_view>
int main()
{
quill::Backend::start();
quill::Logger* logger = quill::Frontend::create_or_get_logger(
"root", quill::Frontend::create_or_get_sink<quill::ConsoleSink>("sink_id_1"));
LOG_INFO(logger, "Hello from {}!", std::string_view{"Quill"});
}
Alternatively, you can use the macro-free mode. See here for details on performance trade-offs.
#include "quill/Backend.h"
#include "quill/Frontend.h"
#include "quill/LogFunctions.h"
#include "quill/Logger.h"
#include "quill/sinks/ConsoleSink.h"
#include <string_view>
int main()
{
quill::Backend::start();
quill::Logger* logger = quill::Frontend::create_or_get_logger(
"root", quill::Frontend::create_or_get_sink<quill::ConsoleSink>("sink_id_1"));
quill::info(logger, "Hello from {}!", std::string_view{"Quill"});
}
🎯 Features
- High-Performance: Ultra-low latency performance. View Benchmarks
- Asynchronous Processing: Background thread handles formatting and I/O, keeping your main thread responsive.
- Minimal Header Includes:
- Frontend: Only
Logger.handLogMacros.hneeded for logging. Lightweight with minimal dependencies. - Backend: Single
.cppfile inclusion. No backend code injection into other translation units.
- Frontend: Only
- Compile-Time Optimization: Eliminate specific log levels at compile time.
- Custom Formatters: Define your own log output patterns. See Formatters.
- Timestamp-Ordered Logs: Simplify debugging of multithreaded applications with chronologically ordered logs.
- Flexible Timestamps: Support for
rdtsc,chrono, orcustom clocks- ideal for simulations and more. - Backtrace Logging: Store messages in a ring buffer for on-demand display. See Backtrace Logging
- Multiple Output Sinks: Console (with color), files (with rotation), JSON, ability to create custom sinks and more.
- Log Filtering: Process only relevant messages. See Filters.
- JSON Logging: Structured log output. See JSON Logging
- Configurable Queue Modes:
bounded/unboundedandblocking/droppingoptions with monitoring on dropped messages, queue reallocations, and blocked hot threads. - Crash Handling: Built-in signal handler for log preservation during crashes.
- Huge Pages Support (Linux): L
Related Skills
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.7kCommit, push, and open a PR
