-
Notifications
You must be signed in to change notification settings - Fork 13
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
Allow forking from existing loggers #15
Conversation
spdlog/src/logger.rs
Outdated
/// Fork and configure a separate new logger. | ||
/// | ||
/// The new logger will be detached from the `Arc` sharing relationship with | ||
/// the old logger and become a separate object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The meaning of "fork" should be further clarified:
Fork and configure a separate new logger.
This function creates a new logger object that inherits logger properties from
self
. Then this function calls the givenmodifier
function which configures the properties on the new logger object. The created new logger object will be a separate object fromself
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to replace self
in your suggestion with Arc<Self>
.
This function creates a new logger object that inherits logger properties from
Arc<Self>
. Then this function calls the givenmodifier
function which configures the properties on the new logger object. The created new logger object will be a separate object fromArc<Self>
. (No ownership sharing)
80b5483
to
d04e7ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I can't imagine a use case for this function. Is it necessary? What's the use case? |
I can't either. So let's not implement it and wait for a feature request to be opened by someone who needs it. |
Closes #13.
To avoid confusion with the semantics of
Arc::clone
, I have named the new methods asfork_xxx
.Unsolved Questions
Not sure if
fn fork(self: &Arc<Self>) -> Result<Arc<Self>>
(no modifier, just fork as is) is also necessary to add.