mcpp index

odygrd.quill

import

Asynchronous logging through the upstream quill C++ module

import quill;
mcpp add odygrd.quill@13.0.0

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

import std;
import quill;

#define QUILL_USE_MODULE
#include <quill/LogMacros.h>

bool log_from_worker(quill::Logger* expected);

bool check_logging(std::filesystem::path const& filename) {
    quill::Backend::start();
    quill::FileSinkConfig config;
    config.set_open_mode('w');
    auto sink = quill::Frontend::create_or_get_sink<quill::FileSink>(filename.string(), config);
    auto* logger = quill::Frontend::create_or_get_logger(
        "quill-module-test", sink, quill::PatternFormatterOptions{"%(message)"});
    logger->set_log_level(quill::LogLevel::Info);

    LOG_INFO(logger, "macro answer={} text={}", 42, std::string{"hello"});
    LOG_DEBUG(logger, "filtered main message");
    bool worker_ok = false;
    {
        std::jthread worker([&] { worker_ok = log_from_worker(logger); });
// …

tests/examples/quill-module/tests/quill.cpp · 项目 tests/examples/quill-module

构建

modules
quill
targets
quill (lib)
language
c++23
import std
no
include dirs
*/include

源文件 (1)

  • */src/quill.cppm

版本

版本平台 镜像sha256
13.0.0 最新 LinuxWindowsmacOS 源站 88b4a1542125…