spdlog-rs
spdlog-rs copied to clipboard
Tracking issue for `runtime_pattern!` macro
As discussed in #45, a RuntimePattern
implementation with a pattern registry that can be dynamically built may have security concerns. Thus, while the pattern template string can be evaluated dynamically, the pattern registry, which is basically a map from string to pattern factories, needs to be built at compile time.
We thus propose a new macro runtime_pattern!
for building runtime patterns. It can be used as follows:
let pattern: RuntimePattern = runtime_pattern!(template_str, {$custom} => Custom::default);
The only difference between pattern!
and runtime_pattern!
is that while pattern!
only accept a string literal, runtime_pattern!
accepts any expressions that evaluate to a string.
This issue tracks the development progress of runtime_pattern!
.