-
Notifications
You must be signed in to change notification settings - Fork 59
feat: add a plugable logging system. #153
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
base: main
Are you sure you want to change the base?
Conversation
default_logger_ = std::static_pointer_cast<void>(logger); | ||
log_func_ = [logger](LogLevel level, std::string_view format_str, | ||
const std::string& formatted_message) { | ||
if (logger->ShouldLog(level)) { | ||
logger->LogImpl(level, "{}", formatted_message); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately we still do a dynamic call, does it save us anything versus a virtual call? It is significantly more complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, function pointers are generally faster than virtual calls, and in some scenarios, the compiler is able to inline them, which can further improve performance.
No description provided.