Asynchronous Low Latency C++ Logging Library
Quill is an asynchronous logging and metrics library for C++17 and later. It keeps formatting and I/O away from latency-sensitive application threads by encoding log arguments on the frontend and processing them on a dedicated backend worker.
Using Quill? Click Star at the top of the GitHub repository to help other C++ developers discover it.
Getting started is easy and straightforward. Follow these steps to integrate the library into your project:
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 |
For the shortest path from zero to working logs, use simple_logger():
#include "quill/SimpleSetup.h"
#include "quill/LogMacros.h"
int main()
{
// log to the console
auto* logger = quill::simple_logger();
LOG_INFO(logger, "Hello from {}!", "Quill");
// log to a file
auto* logger2 = quill::simple_logger("test.log");
LOG_WARNING(logger2, "This message goes to a file");
}Console output:
20:07:18.423476231 [48917] main.cpp:8 LOG_INFO Hello from Quill!If you want explicit control over backend options, logger names, sinks, or formatters, use the
Backend and Frontend APIs directly:
#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"});
}Output:
20:07:18.423476231 [48917] main.cpp:15 LOG_INFO root Hello from Quill!You can also use the macro-free mode. The macro API (LOG_INFO) is the lowest-latency path.
The function API (quill::info) reads more like ordinary code but is slightly slower.
See here for the 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"});
}Register MetricMetadata once, then publish double samples from hot threads through the same asynchronous backend
used for logs. The bundled PrometheusSink handles counters, gauges, histograms, and summaries; custom sinks can route
samples to StatsD, OpenTelemetry, or any in-process collector via Sink::write_metric().
// One-time registration — returns a stable pointer valid for program lifetime.
quill::MetricMetadata const* requests_total = quill::Frontend::create_metric(
"requests_total_post_200", "requests_total", {{"method", "POST"}, {"status", "200"}});
// Hot path — no label serialization, just a pointer and a double.
logger->publish_metric(requests_total, 1.0);See the Metrics guide for sink setup, custom sinks, and Prometheus integration.
Logger.h and LogMacros.h needed for logging. Lightweight with minimal dependencies..cpp file inclusion. No backend code injection into other translation units.rdtsc, chrono, or custom clocks - ideal for simulations and more.LOG_*_LIMIT / LOGV_*_LIMIT emit at most once per configured interval per call site.bounded/unbounded and blocking/dropping options with monitoring on dropped messages,
queue reallocations, and blocked hot threads.Quill Version: v13.0.0
OS: Linux RHEL 9.4
CPU: Intel Core i5-12600 (12th Gen) @ 4.8 GHz
Compiler: GCC 14.2
Build: Release with -march=x86-64-v3
Benchmark-Tuned System: The system is specifically tuned for benchmarking.
Command Line Parameters:
$ cat /proc/cmdline
BOOT_IMAGE=(hd0,gpt2)/vmlinuz-5.14.0-427.13.1.el9_4.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet nohz=on nohz_full=1-5 rcu_nocbs=1-5 isolcpus=1-5 mitigations=off transparent_hugepage=never intel_pstate=disable nosoftlockup irqaffinity=0 processor.max_cstate=1 nosoftirqd sched_tick_offload=0 spec_store_bypass_disable=off spectre_v2=off iommu=ptYou can find the benchmark code on the logger_benchmarks repository.
The results presented in the tables below are measured in nanoseconds (ns).
The tables are sorted by the 90th percentile (lower is better).
LOG_INFO(logger, "Logging int: {}, int: {}, double: {}", i, j, d).
| Library | 50th | 75th | 90th | 95th | 99th | 99.9th |
|---|---|---|---|---|---|---|
| fmtlog | 6 | 6 | 6 | 6 | 7 | 10 |
| Quill Bounded Dropping Queue | 6 | 6 | 6 | 6 | 8 | 9 |
| XTR | 6 | 6 | 6 | 6 | 9 | 10 |
| Quill Unbounded Queue | 6 | 6 | 6 | 7 | 8 | 10 |
| PlatformLab NanoLog | 8 | 8 | 9 | 10 | 10 | 11 |
| Quill - Macro Free Mode | 11 | 12 | 14 | 15 | 16 | 18 |
| [ |
No open issues yet, or sync has not completed.