Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Log Level Names #489

Closed
llchan opened this issue Jul 4, 2024 · 3 comments
Closed

Custom Log Level Names #489

llchan opened this issue Jul 4, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@llchan
Copy link

llchan commented Jul 4, 2024

It would be useful to be able to define something like -DQUILL_LOG_LEVEL_NAME_DEBUG=DBG to customize the log level names. Compile-time constants are good enough, no need for runtime configurability as that may incur additional overhead.

@odygrd
Copy link
Owner

odygrd commented Jul 13, 2024

I'd rather steer clear of introducing preprocessor directives to alter the library's behavior. It took considerable effort to eliminate them in the latest version, and they aren't compatible with C++ modules. The only area where I'm permitting their use in the library is LogMacros.h, since even with modules, it must be included due to its macro content.

This has been done in master as runtime, it doesn't seem to have any noticeable difference in performance.

For example:

quill::BackendOptions backend_options;
backend_options.log_level_descriptions[static_cast<uint32_t>(quill::LogLevel::Warning)] = "WARN";
quill::Backend::start(backend_options);

@odygrd odygrd closed this as completed Jul 13, 2024
@odygrd odygrd added the enhancement New feature or request label Jul 13, 2024
@llchan
Copy link
Author

llchan commented Jul 13, 2024

Yep runtime works too if it's now exposed in v5.0.0, thanks! 👍🏼

@odygrd
Copy link
Owner

odygrd commented Jul 13, 2024

Yes it is included in v5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants