Open izolyomi opened 2 months ago
Can I please have an opinion whether the direction taken by these few lines of changes looks reasonable to any main contributor? Would a detailed rationale help the review?
@izolyomi For context we have been slowly exposing more internals, this is not a use case that was considered.
My only issue with this impl is the env mode, there are a number of other places that would also set the max log level and therefore it would be inconsistent. I think the only way we can get away with this without a major version or inconsistent api is either add a set_max_level
param to the config or peer methods where set_max_level is called in log4rs, but without that functionality. (eg init_config_without_max_level(config))
As for pub fn handle
I think there is some reason log
does not recommend this. In lieu of this I would suggest just saving the handle somewhere accessible for later use.
My only issue with this impl is the env mode, there are a number of other places that would also set the max log level and therefore it would be inconsistent. I think the only way we can get away with this without a major version or inconsistent api is either add a
set_max_level
param to the config or peer methods where set_max_level is called in log4rs, but without that functionality. (eg init_config_without_max_level(config))As for
pub fn handle
I think there is some reasonlog
does not recommend this. In lieu of this I would suggest just saving the handle somewhere accessible for later use.
Thank you for the review and the reply, I agree that the environment mode was not fully consistent. Considering other possibilities some more, I've realized that whenever the logger is externally reconfigured then it can be the caller's responsibility to keep the global log level consistent by calling log::set_max_level
after set_config()
. Consequently, I've removed the environment mode from my suggested changes.
I think the PR became trivial now, is it acceptable in the current form?
Frankly I couldn't fully understand your train of thoughts at pub fn handle
, do you see a better way to make it accessible?
Is there any planned timeline to review and hopefully merge the dozen lines of the updated PR?
I guess it's a NO then.
Based on the discussion in issue https://github.com/estk/log4rs/issues/390 this is a proof-of-concept experiment that enables using log4rs in a multilog environment.
Probably naming, documentation and others can still be improved a lot, what do you think?