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.
The
log
crate support specifying log target in the syntax below:The log target is a string that can be fully customized. Before this PR, this field is not used in spdlog-rs. Actually it can be used as a way to announce the logger name when you want to emit logs in a library through the
log
crate. Thus, in this PR, I used this information as another source of logger names.Specifically, when constructing a
spdlog::Record
from alog::Record
with a specificspdlog::Logger
: (see also source)spdlog::Logger
has a logger name configured, the logger name of the constructedspdlog::Record
will be that name.log::Record
has a non-emptytarget
, the logger name of the constructedspdlog::Record
will be that value.spdlog::Record
will beNone
.API Breaking
This PR indeed has potential impacts. It's actually API breaking because the signature of
spdlog::Record::logger_name
is updated from:to:
. This is because we have to change the way we store the logger name in
spdlog::Record
. Before this PR, the logger name is simply represented by a&'a str
. In this PR, I need to update its type toCow<&'a, str>
because I have to store an owned version of the log target name if the record is constructed from a log crate record.But I believe the impact of this change should be minimal.