quill icon indicating copy to clipboard operation
quill copied to clipboard

C++ named module for quill

Open sharadhr opened this issue 1 month ago • 1 comments

I am currently writing a module-only project, and it would be nice to use quill as a C++ module. If the maintainers/developers have bandwidth, this would be really lovely to see; otherwise, I can slowly stand up a PR based on the 'ABI-breaking' style.

Note that quill's dependency fmt provides a module interface file which appears to be missing here, which will need to be added.

Another note that most macros will be unavailable, and may need inline, constexpr, or consteval alternatives.

sharadhr avatar Nov 23 '25 22:11 sharadhr

Thanks for the suggestion! Adding native C++20 module support is definitely something we’d like to do in the long term, but it’s not on the immediate roadmap.

Modules still aren’t widely adopted, and a number of compilers and package managers handle them inconsistently.

Since quill is header-only, you can experiment with providing your own module interface on the consumer side. It won’t be a fully modular solution—because the module interface will still include the original headers internally rather than replacing them with true module partitions—but it should work fine in practice.

Here’s a minimal example of how you might wrap and re-export quill from your own module interface (untested but conceptually correct):

// quill-wrapper.cppm
export module quill;

// Import the headers you need from quill
#include <quill/Logger.h>
// … add whichever headers are relevant

export namespace quill_export {
    using namespace quill;
}

This essentially gives you a module facade while still relying on the header-only implementation underneath.

About macros LogMacros.h still needs to be included in any translation unit that uses the logging macros—macros cannot be exported from modules. If you prefer a macro-free approach, you can instead use the LogFunctions.h API. It introduces a small performance penalty but should work cleanly with modules.

odygrd avatar Nov 23 '25 23:11 odygrd