Feature: Add ability to implement custom loggers #313
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
this PR implements the ability to implement custom loggers in consuming applications. I've tried to keep the changes minimal, but there is still some room to make them even more minimal (see notes for details).
Some Notes:
METALL_LOGGER_EXTERN_C=1
and then provide a defintion for
metall_log
somewhere. If you don't like how that works, feel free to suggest something elsemetall_log
is intentionally anextern "C"
interface so that it can be easily used in FFI/cross-language contexts, i.e. this gives the ability to implement the logger behaviour in a foreign language that is notC
orC++
, which has the advantage of having the ability to neatly integrate into the native logging interface of the foreign languagesilent
loggerlevel
and factored it out into thelevel_filter
. The reason being thatsilent
is not really a log level and there isn't really a point in ever logging silent messages, because they are always ignored. But of course this is an interface change so I would understand if you didn't like it, in that case I can revert this detail back to its original state. Otherwise no change in interface has occured (in the default configuration)This is related to #297