-
Notifications
You must be signed in to change notification settings - Fork 259
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
Rewrite liblog into a logging facade #12
Conversation
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
I have a port of the old logging implementation here: https://github.com/sfackler/log-ng/tree/master/basic Do you think it makes sense to keep it in this repo or in another? |
487f64b
to
e697419
Compare
See issue rust-lang#3 for background. Closes rust-lang#3 Closes rust-lang#7 Closes rust-lang#11
fn clone(&self) -> LogLevel { | ||
*self | ||
} | ||
} |
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.
Does derive
not work here?
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.
derive
generates really bad code for all of these methods.
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.
Ah ok!
Yeah let's keep at least one implementation here in the repo. There should probably be an example or two as well showing how to depend on it and use it. |
I chatted with some others about rewriting some of the libraries in rust-lang, and our general conclusion was that if a total rewrite is happening it should probably happen out of repo, but if an API overhaul is happening (e.g. changing to a builder interface for getopts from free functions) then it's fine to stick to the same repo for now (with a version bump). I think that this falls into the category of API overhaul rather than total rewrite (despite it being a total rewrite!) due to the macros staying the same. If the old behavior is kept in this repo as a "basic" crate then I'm totally fine keeping it all in this repo. Thanks so much for working on this @sfackler, this all looks pretty awesome to me and I'm excited to see where it goes! |
Ok, pushed a bunch of changes for your comments, and added the 1.0 logger port as a separate crate. It's named One thing I have been thinking about is the possibility of reexporting the logging macros from |
It'd be the difference between [dependencies]
log = "0.2"
env_logger = "0.1" #[macro_use]
extern crate log;
extern crate env_logger; and [dependencies]
env_logger = "0.1" #[macro_use]
extern crate env_logger; Pretty minimal, but mildly more convenient for quick things. |
Thanks! Here's a list of what I can think is left
And... I think that's it! All the other docs look good to me.
I'd probably prefer to keep the two separate for now as it may be annoying to "require" all logging crates to reexport the logging macros. If it gets too painful in the future though we an definitely look into reexporting. |
SGTM |
Docs and README have been updated. |
One last thing to note is that |
This somewhat silently turns all debug!() calls on in release builds, unless a cfg is passed? |
Yep. There's some discussion of it in #3. The higher verbosity logging levels are pretty important to keep around in release builds in my experience, because they're often one of the only options you have if an issue pops up that's hard/infeasible to reproduce outside of a production instance. The cfgs offer a more uniform interface to completely disabling logging at whatever level you'd like. |
Yea I saw that. I guess as long as the expensive part is inside the fmt On Tue, Jan 27, 2015, 10:07 AM Steven Fackler [email protected]
|
See issue #3 for background.
Closes #3
Closes #7
Closes #11