-
Notifications
You must be signed in to change notification settings - Fork 128
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
Debug traits for structs #20
Conversation
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.
Thanks @shivanth!
@@ -459,6 +460,19 @@ impl Log for Logger { | |||
fn flush(&self) {} | |||
} | |||
|
|||
impl fmt::Debug for Logger{ |
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.
There are some nice helper methods on Formatter
that can make this easier. So you could have something like:
f.debug_struct("Logger")
.field("directives", &self.directives)
.field("filter", &self.filter)
.field("target", &self.target)
.finish()
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.
Done :-)
@@ -4,6 +4,7 @@ use std::fmt; | |||
|
|||
use self::regex::Regex; | |||
|
|||
#[derive(Debug)] |
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.
Do we want the debug representation to display the values of these private internal fields? Right now this will output the debug value of the inner: Regex
field. We may well want that, but I think it's worth making that decision explicit. Are you ok with this @sebasmagri?
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.
Any comments on this ?
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 this is ok. Let's merge this in.
Fixes #14