agentleFS
odygrdodygrd/quill/skills/quill/SKILL.md

quill

Skill3.1k starsChanged 22 months agoMITView on GitHub

Quill v14 (odygrd/quill), the asynchronous C++ logging library: write, review and fix code that uses it, and migrate, convert or port a codebase to Quill from spdlog, glog, fmtlog, Boost.Log, NanoLog, printf or iostream logging. Use for quill/ includes, quill::Backend, quill::Frontend, quill::Logger, the LOG_INFO / LOG_DEBUG / LOG_ERROR / LOGV_ / LOGJ_ / LOG_BINARY macros, quill::info(), adding logging to C++ code that uses or should use Quill, sinks, file rotation, JSON logs, patterns, log levels, FrontendOptions queues, BackendOptions, logging STL or user-defined types (codecs), "Missing Codec for Type" and other Quill build errors, missing log output, and code written for an older Quill (quill::start, quill::get_logger, quill::Config, handlers).

8 other projects use a version of this.

Trending

Quiet since October.about the whole repository

Jan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 2 mentionsApr 2026: 1 mentionMay 2026: 0 mentionsJun 2026: 2 mentionsJul 2026: 3 mentionsAug 2026: 9 mentionsSep 2026: 2 mentionsOct 2026: 5 mentionsNov 2026: 0 mentionsDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the odygrd/quill repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about odygrd/quill

The biggest 5 of 56 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 56

Talked about on GitHub, Hacker News and Stack Overflow (56 times).

On GitHub · 50

45 more on GitHub
  • Other versions8 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 8

    1. cwinvestments/memstack★ 433same name
    2. simota/agent-skills★ 106same name
    3. bekhruztbx/ai-creative-team★ 18same name
    4. cgartlab/quill★ 2same name
    5. codingpains/skills★ 1same name
    6. gc4rella/quill★ 1same name
    7. iamsikun/quill★ 1same name
    8. vbrevik/claude_code_skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Search the project for Backend::start first and reuse its setup library, loggers, macros and FrontendImpl<...> aliases.

    line 30
  2. Very specific:

    Every binary, tests included, links the setup library, whose sources include quill/Backend.h: otherwise …

    line 165
  3. Very specific:

    Create sinks and loggers once at startup and keep the quill::Logger*.

    line 167
  4. Distinctive:

    Never log inside a formatter, a codec, a copy constructor used by a codec, or a user clock.

    line 177
  5. Very specific:

    Do not log from destructors of static or global objects.

    line 187
  6. Very specific:

    After a change, run once and read stderr: Quill reports invalid patterns, format errors, dropped records and queue growth there.

    line 196
  7. Distinctive:

    Read the one file that matches the task.

    line 219

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Quill v14

Header-only asynchronous C++17 logging: a log call copies its arguments into the calling thread's lock-free queue, and one backend thread formats and writes them. Namespace quill; the bundled {fmt} is fmtquill.

Do not write Quill from memory. The API changed in v4, v7, v10 and v14, and models recall the old forms (quill::start(), quill::get_logger(), handlers). Use the forms below. A project that pins an older release (GIT_TAG, vcpkg.json, Conan) or whose QUILL_VERSION_MAJOR is missing or below 14 uses an older Quill: read references/stale-api.md and keep its version unless asked to upgrade.

Setup

Search the project for Backend::start first and reuse its setup library, loggers, macros and FrontendImpl<...> aliases. New setup code in a project with more than one .cpp follows these two rules; name and arrange the files to fit the project. When existing code breaks them, recommend the change and why (compile time, one place to configure), and restructure only if the user agrees:

  • A small static library owns the setup, linked into the executables and tests. Its sources are the only files that include quill/Backend.h, quill/Frontend.h and quill/sinks/*.h, the slow headers to compile. Static keeps one copy of Quill's state, and on Linux a log call in an executable needs no TLS lookup, which a call compiled into a shared library has: recommend it also where the project uses shared libraries. Only when the user asks or the project requires it, build the setup library as the one shared library that owns Quill: references/setup.md. Never link the static one into several shared modules.
  • Files that log include the project's logging header and the quill/std/ headers of the STL types they log. The logging header includes only quill/Logger.h and quill/LogMacros.h (quill/LogFunctions.h for quill::info()). Never put the setup headers in a header.

One way, when the project has no setup yet:

// file: app_log.h
#pragma once

#include "quill/LogMacros.h"
#include "quill/Logger.h"

namespace app
{
void init_logging(char const* log_file); // call once, first thing in main()
extern quill::Logger* logger;            // valid after init_logging()
} // namespace app
// file: app_log.cpp
#include "app_log.h"

#include "quill/Backend.h"
#include "quill/Frontend.h"
#include "quill/sinks/ConsoleSink.h"
#include "quill/sinks/FileSink.h"

namespace app
{
quill::Logger* logger{nullptr};

void init_logging(char const* log_file)
{
  quill::Backend::start(); // once per process; a normal exit stops it and writes what is queued

  auto console = quill::Frontend::create_or_get_sink<quill::ConsoleSink>("console");
  auto file = quill::Frontend::create_or_get_sink<quill::FileSink>(log_file); // appends

  logger = quill::Frontend::create_or_get_logger(
    "app", {console, file},
    quill::PatternFormatterOptions{
      "%(time) [%(thread_id)] %(short_source_location:<28) %(log_level:<9) %(logger:<12) %(message)%(mdc)",
      "%Y-%m-%d %H:%M:%S.%Qus", quill::Timezone::GmtTime});
}
} // namespace app
// file: main.cpp
#include "app_log.h"

int main()
{
  app::init_logging("app.log");
  LOG_INFO(app::logger, "Listening on port {}", 8080);
}
add_library(app_log STATIC app_log.cpp)
target_compile_features(app_log PUBLIC cxx_std_17)
target_include_directories(app_log PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(app_log PUBLIC quill::quill)

target_link_libraries(app PRIVATE app_log) # every target that logs
  • A program of one .cpp: put the body of init_logging() at the top of main().
  • Throwaway program: quill/SimpleSetup.h and quill/LogMacros.h, then quill::simple_logger() (stdout), simple_logger("stderr") or simple_logger("app.log"), which starts the backend.
  • Build: CMake target quill::quill, or -std=c++17 -I<quill>/include -pthread; MSVC /std:c++17 /EHsc /I<quill>\include.

Log statements

<LEVEL> is TRACE_L3 (most verbose), TRACE_L2, TRACE_L1, DEBUG, INFO, NOTICE, WARNING, ERROR or CRITICAL. A logger starts at Info: logger->set_log_level(quill::LogLevel::Debug).

StatementResult
LOG_INFO(logger, "order {} px {:.2f}", id, px);{fmt} syntax, formatted on the backend thread
LOGV_INFO(logger, "fill", id, px);fill [id: 7, px: 1.5]
LOGJ_INFO(logger, "fill", id, px);fields id and px in JSON sinks, fill 7, 1.5 as text
LOG_WARNING_LIMIT(std::chrono::seconds{1}, logger, "slow {}", ms);at most once per interval, per call site and thread
LOG_DEBUG_LIMIT_EVERY_N(100, logger, "tick {}", n);every 100th call
LOG_INFO_TAGS(logger, TAGS("net"), "connected");tags, printed by %(tags)
LOG_DYNAMIC(logger, level, "text {}", x);level is a run-time quill::LogLevel
quill::info(logger, "text {}", x);no macro (quill/LogFunctions.h); arguments are evaluated even when the level is off

Arguments

TypeNeeds
Arithmetic, bool, char, std::string, std::string_view, char const*, char[N], void const*nothing; the call copies strings, so temporaries are safe
Enumformat_as(E) in the enum's namespace, or a cast at the call
std::vector, std::map, std::optional, std::chrono types and other STL types#include "quill/std/<Type>.h" for each type in the nesting (Vector.h, Map.h, Optional.h, Pair.h, Chrono.h, ...)
Your type that owns its datafmtquill::formatter<T> or format_as(T), plus template <> struct quill::Codec<T> : quill::DeferredFormatCodec<T> {}; (quill/DeferredFormatCodec.h)
Your type with pointer, reference or std::string_view membersthe same with quill::DirectFormatCodec<T> (quill/DirectFormatCodec.h), which formats on the calling thread. A DeferredFormatCodec copies the object and the backend formats the copy later, when such members dangle
Your type with only operator<<QUILL_LOGGABLE_DEFERRED_FORMAT(T) or QUILL_LOGGABLE_DIRECT_FORMAT(T) (quill/HelperMacros.h)
T*, smart pointers, std::thread::id, exceptionsnot loggable: pass static_cast<void const*>(p), *p, e.what()

Decisions

DecisionDefaultChange it when
Full queuegrows from 128 KiB per thread to 2 GiB, then blocksa log call must never block (BoundedDropping), or memory must stay fixed (BoundedBlocking)
Backend threadsleeps 500 us when idle (10 ms on Android; on Windows until the timer tick, ~15.6 ms), not pinnedshorter delay to the sinks: sleep_duration = 0 and cpu_affinity
Flushingwhen the backend is idle, at most every 200 msthe output is read right after: logger->flush_log()
Crashesqueued records are loststart the backend with quill::SignalHandlerOptions
ClockTSCexact wall time, tests, simulated time
Loggersonea level, name or file per subsystem
Unused levelschecked at run timecompile them out: QUILL_COMPILE_ACTIVE_LOG_LEVEL

Details: the first five in references/runtime.md, the last two in setup.md.

Rules

  1. Nothing is written until quill::Backend::start() runs. One call per process.
  2. Every binary, tests included, links the setup library, whose sources include quill/Backend.h: otherwise quill::v14::detail::get_scoped_thread_context_impl is undefined (MSVC LNK2019).
  3. Create sinks and loggers once at startup and keep the quill::Logger*. create_or_get_logger and create_or_get_sink return an existing name unchanged, ignoring the new arguments (with RTTI, a sink type the existing sink does not derive from throws). A logger's sinks, pattern and clock never change: Frontend::remove_logger_blocking(logger) while the backend runs, then create it again.
  4. The macros do not check the logger: a null or removed Logger* crashes.
  5. Format strings are literals with {}. %d is printed as it is. They are checked on the backend, not by the compiler: a mismatch prints [Could not format log statement ...] at run time.
  6. Missing Codec for Type means the argument needs a row of the Arguments table; type_is_unformattable_for means its formatter or format_as is missing.
  7. Never log inside a formatter, a codec, a copy constructor used by a codec, or a user clock. A static with a destructor that a sink or formatter uses must exist before Backend::start(): the drain at exit runs after the destructors of statics constructed later, and on Windows one first initialised during that drain hangs the exit.
  8. One FrontendOptions type per program. Custom options derive from quill::FrontendOptions; files that log then use quill::LoggerImpl<Options>, and only the setup sources quill::FrontendImpl<Options>, which needs quill/Frontend.h.
  9. flush_log() and remove_logger_blocking() wait for the backend. Called with no backend running they return at once, the removal only requested. Never call them from a sink, filter, error_notifier or the thread that polls a ManualBackendWorker: they throw, or hang.
  10. Do not log from destructors of static or global objects. With fork(), start the backend after the fork, in each process.
  11. A pattern is checked on the backend. An unknown or repeated attribute only prints Invalid format pattern to stderr, and that logger then writes nothing.
  12. In a message with a string, char or user-type argument, bytes outside printable ASCII, tab, CR and LF print as \xNN unless backend_options.check_printable_char = {}.
  13. <syslog.h> and other libraries define LOG_INFO, LOG_DEBUG, LOG_WARNING. In such files define QUILL_DISABLE_NON_PREFIXED_MACROS and write QUILL_LOG_INFO(...).
  14. On a hot path use the macros, pass values, not pre-formatted strings, and never call flush_log().
  15. After a change, run once and read stderr: Quill reports invalid patterns, format errors, dropped records and queue growth there.

Old forms that do not compile in v14

Do not writeWrite
#include "quill/Quill.h"the logging header of the setup above
quill::start()quill::Backend::start()
quill::Config, quill::configure(cfg)quill::BackendOptions passed to Backend::start()
quill::get_logger(), quill::create_logger()quill::Frontend::create_or_get_logger("name", sink); there is no root logger
quill::stdout_handler(), quill::file_handler(), HandlerFrontend::create_or_get_sink<quill::ConsoleSink>("id"), <quill::FileSink>("path")
handler->set_pattern(...)quill::PatternFormatterOptions{...} when creating the logger
quill::flush()logger->flush_log()
Backend::start_with_signal_handler<...>()Backend::start<quill::FrontendOptions>(options, quill::SignalHandlerOptions{})
a quill::ClockSourceType or &clock argumentquill::ClockSource::system(), quill::ClockSource::custom(clock)
write_log(MacroMetadata const*, uint64_t, ...) in a sinkwrite_log(quill::LogRecord const& record)
LOG_WARN, LOG_TRACE, LOG_FATAL, LOG_INFO_WITH_TAGS, LOG_INFO_CFORMATLOG_WARNING, LOG_TRACE_L1, LOG_CRITICAL, LOG_INFO_TAGS, LOG_INFO with {}
fmt::formatter<T> or std::formatter<T> for a logged typefmtquill::formatter<T>
quill::loglevel_from_stringquill::log_level_from_string

References

Read the one file that matches the task.

FileRead it when
setup.mdadding Quill to a build, the setup library's details, several loggers, compile definitions, the C++20 module, shared libraries and DLLs, Windows and MSVC
types.mdan argument is an STL type, an enum or a class, or a codec or formatter error appears
output.mdchoosing or configuring sinks, rotation, JSON, filters, a custom sink, the line pattern
runtime.mdqueues, FrontendOptions, BackendOptions, performance, flushing, shutdown, signals, fork(), clocks, unit tests
features.mdnamed arguments, rate limits, tags, MDC, backtrace, the function API, records from another API
data-files.mdbinary records, pcap captures, CSV files, metrics
stale-api.mdcode or an example does not match this skill, or Quill is being upgraded
migrate.mdreplacing another logging library; it names the file with the mapping for each one

Everything else is in the documentation: https://quillcpp.readthedocs.io/llms.txt lists the pages and https://quillcpp.readthedocs.io/llms-full.txt holds them in one file. Each option is also documented in the header that declares it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.