Replies: 1 comment
-
Hey, All named arguments are stored in the same vector, so what you're asking isn't directly possible. You'll need to manually process them in your user-defined Here's how it works: QUILL_LOG_ERROR(logger, "{message}", msg, ##__VA_ARGS__); In the example above, the named argument Any subsequent arguments—since they don't have a So you'll see entries like If you want to separate them, you'll have to filter and handle them yourself in your custom sink implementation. Also, consider why you need the extra tags. If it's just for tagging purposes—such as marking certain logs as errors—you might want to look into log tagging in Quill. Note that log tagging uses compile-time static tags, which differs from your current approach that looks more like runtime tagging. There is an example here Hope this helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First of, love the library, lets me do so much customization. I'm having to support dual logging based on run time config - either a JSON format or a proprietary format. I want to discuss a question for the proprietary format. The pattern itself is unimportant, I'm trying to see if there's a library feature I haven't read about that might help me better with extra key-value pairs.
I have a macro that does
I have a custom console sink
So when I call my macro
MY_LOG_DEBUG("Hello {}", "world", "{another key}", "value");
The print from write_log will read
Getting the key of
message
and valueHello world
is great and what I need. And I can push every value whose key begins with_
into another vector and then turn them into key-value pairs at position i and i+1. All this works, but is there any way to just get the extra args as key-value pairs directly? So the named_args loop would printBeta Was this translation helpful? Give feedback.
All reactions