-
Notifications
You must be signed in to change notification settings - Fork 379
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
Libraries logging callbacks / json
output
#2288
Comments
Here is my current opinion summarized:
Some Notes:
I agree, though this means that the callback must be called in-place as soon as the record is built - no other latency introduced.
We could model a similar type (reuse the implementation from boost or other sources?) and replace it by |
I meant formatting in with |
I am writing a comment here because it's related to logging, and we should consider this when thinking about the different possible solutions: This leads to several issues:
|
Good points @Hind-M and I would also add that the Powerloader integration PR is also "fixing" the behavior of
|
Additional requirement in #3415 |
json
output
This issue ended up tracking both |
For
libmamba
to be free of side effects (such as printing), it is best to provide dependency-free callback functions for logging purposes.Users, including micromamba (or a verbose
libmambacli
), can then set these callbacks to forward the output to a log, a stdout/stderr...Goals
Yes-goals
It would useful if the callback functions handle the following inputs:
libmamba
private dependencies as well.No-goals
Re-writing a logging library is not a goal here. Everything that can be done by the user (eventually though a 3rd party) should be excluded, for example:
Maybe-goals
std::ostream
(or similar way to provide a message by parts) support for avoiding allocating temporary stringsfmt
formatting and concatenating on lib mamba side, for instanceImplementation
Source
In C++20, we'de have
std::source_location
. Otherwise we can use macros with__FILE__
and the like (no portable function name though).Enums vs mulitple callbacks
Should users provide one callback per log level
Or a single function with a log level
log(mamba::LogLevel lvl, std::string_view msg)
The former is mostly useful for if there is no way to pass the message by parts (e.g.
std::ostream
) to the user so that temporary allocations can be deactivated as needed.The text was updated successfully, but these errors were encountered: