Skip to content

add Debug derive for OsLogger struct - #5

Open
carl-wallace wants to merge 2 commits into
steven-joruk:masterfrom
carl-wallace:master
Open

carl-wallace wants to merge 2 commits into
steven-joruk:masterfrom
carl-wallace:master

Conversation

@carl-wallace

Copy link
Copy Markdown

This allows an instance of OsLogger to be factored into a manually constructed log4rs configuration so stdout or a file appender can be used alongside an appender for Apple's logging system

…nto a manually constructed configuration using log4rs

@simlay simlay left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not affiliated with this repo but I watch. I don't like to just critique but I have some thoughts. I see why you might want to use the derivative crate but I would argue that derivative shouldn't be on by default or a sub-feature to logger. Part of my argument stems from that derivative hasn't been updated in 3 years. Then when using this crate you could enable derivative via oslog = { version = "*", features = ["logger", "derivative"] }

Comment thread src/logger.rs Outdated
Comment on lines +6 to +9
#[derive(Derivative)]
#[derivative(Debug)]
pub struct OsLogger {
#[derivative(Debug = "ignore")]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can use a cfg_attr. ie: #[cfg_attr(derivative, derive(Derivative))].

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Derivative was used solely because that is what decorates similar structs in log4rs. I should feature gated this but did not think about that until after. I will give your suggestions a try and add a feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants