Retain source location from log
crate if they are &'static
#23
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.
Fixes #22.
The problem is that the source location from the
log
crate is an internal typeMaybeStaticStr<'a>
which is like aCow<'static, str>
, so that means they are possible to be runtime&'a str
instead of&'static str
.I had left a
None
for thesource_location
inside the proxy since we store location information as&'static str
so there is no way to store runtime&'a str
in it unless we change the API.But reconsider the situation, most crates only use the logging macros from
log
crate instead of constructing something manually, and source location from macros should always be&'static str
, So we can safely ignore those&'a str
cases, which should not be a big problem.