-
Notifications
You must be signed in to change notification settings - Fork 256
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
open to a PR for deinitialize? #327
Comments
Previous versions of the crate supported deinitialization, but we removed it as it added a nontrivial synchronization cost to every log call. You use case seems like it would be better served by having the logger implementations expose their loggers directly anyway, right? See also #267 |
It would certainly be better served by forcing the logger implementations to expose their loggers in a standard way, but that seems like a much more intrusive change since it would require a major rev. What if I can find a way to do it without the synchronization cost? |
There would be no change to this crate - you'd instead go to the various logger crates and ask them to expose direct constructors for their loggers. |
It turns out there's a reason I italicized "forcing" above. I'm looking for a solution I can depend on, and herding all those cats doesn't strike me as one of those. Even if I got them into line once there's nothing that keeps them there. But it sounds like the answer to my question is "no, even if there's no per-log-call sync cost, we're not open to this change". |
I have a similar goal because I want to change the format of the logger after I've already initialized it. This is because I want to include a transaction ID in the format as soon as I've identified it. Unfortunately, this is not possible immediately and I want to be able to log potential errors without having a transaction ID. Since I can neither change the format of the logger nor set a new one, I have no idea how to do this. Do you have a suggestion? |
It seems like you'd want your logger implementation to provide the ability to adjust its configuration. |
Seems so, but I haven't found one that can do that after the logger has been globally initialized. |
log4rs can do that as one example. |
Thanks a lot! But I'd hoped to find something simpler. Are there any criterias I can search for? |
Not sure. |
I'm using log4rs in a crate that's consumed over FFI and am looking for a way to free the logger's memory / drop the logger. Right now I reconfigure log4rs with a logger that's as simple as possible. But it still requires some memory. log4rs sets its own logger using There's no way to "undo" that, right? |
Just coming through some triage. It's been a while since we've had any activity here. I don't think we're looking at re-introducing de-initialization support in |
* Change typeof `Args::targets` to `Option<Vec<String>>` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Hello all, I was wondering if this crate would be open to a PR that adds
pub fn deinitialize() -> Option<&'static Log>
. The goal is that I'd like to be able to write a crate for composing loggers, but currently loggers aren't constrained to expose the loggers they generate publicly, so the only way to reliably compose them would be to have some means of pulling them out of your&'static mut LOGGER
.The text was updated successfully, but these errors were encountered: