-
Notifications
You must be signed in to change notification settings - Fork 263
LogLocation
lifetimes.
#94
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
Comments
I think extending these lifetimes would be fine - thoughts @alexcrichton? |
It may make it harder to dynamically generate these records in the future, but I'm not sure if there's even a case for that? |
|
Actually. Is there any reason why The drawback is, that logging backend would not be able to save the |
I would like to suggest a different idea. As mentioned in this other post, an important use case is integrating a foreign logging system, so that messages from this system (e.g. a C library) can be forwarded to the Rust logger. The location of such foreign log messages is not necessarily a static string, or may not even be in UTF-8, requiring a dynamic conversion. To accommodate for this, wouldn't it be better to define pub struct Location {
pub __module_path: Cow<'static, str>,
pub __file: Cow<'static, str>,
pub __line: u32,
} This avoids the cost of dynamic allocation for logging originating from Rust code while allowing locations not defined statically (e.g. because they come from a C library). One potential drawback is that Of course the use case of integrating a foreign logging system depends on #95 to define a |
This would be great but unfortunately there is no |
Thank you. I opened #206 to track the integration with foreign loggers and the no_std issue is mentioned in #206 (comment). |
See this issue: cargo-bins/cargo-quickinstall#27 Quick Install is a hosted repo of built crates, essentially. The approach I've taken here is a list of strategies: 1. First, we check the crate meta or default and build the URL to the repo. Once we have that, we perform a `HEAD` request to the URL to see if it's available. 2. If it's not, we build the URL to the quickinstall repo, and perform a `HEAD` to there. As soon as we've got a hit, we use that. I've built it so it's extensible with more strategies. This could be useful for rust-lang#4. This also adds a prompt before downloading from third-party sources, and logs a short name for a source, which is easier to glance than a full URL, and includes a quick refactor of the install/link machinery.
Could
LogLocation::module_path()
andLogLocation::file
return'static str
, since they own them as &'static str? I am actually hitting this, and I need to use hidden variables directly instead.The text was updated successfully, but these errors were encountered: