-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Redesign the logging subsystem #3309
Comments
Note related request #4397 |
Note related request #3309 |
Hitting for triage |
A |
Nominating to de-nominate this issue, it's becoming less clear how to make progress on this issue as the sub-bugs are getting closed (just a few left after a branch of mine lands). I'll be nominating sub-bugs which I think should be nominated as well. |
This makes some headway on #3309, see commits for details.
De-nominating since it's mostly done. |
I feel like a big goal of this work was the ability for other people to make use of the logging system for something more than debug printfs. At first I was writing a comment saying how we hadn't even started on this design work as far as I could tell, but thinking more about it I decided that since designing a "one size fits all" logging system is quite the challenge, perhaps all we should really offer is some way to check whether logging for the current module is enabled at a given logging level. People can then build their own macros that do the equivalent of
probably this hinges on some sort of macro so that we can have the macro be "enabled for the current module". As a bonus, this would probably permit us to write log statements that are enabled/disabled by the status of another module, which I've wanted on occasion. |
Does the previous make sense? If so I'll open another bug. Either way, not a 1.0 issue. |
Despite the sub-tasks of this bug mostly being done, it seems that the general feeling is that "logging needs work", but at least to me it's unclear what work needs to get done (or what the general vision is for a futuristic logging system). This may be the appropriate place for such a description (it would pretty much replace the current one), but a new bug would also be fine. As mentioned on IRC though, we do have a |
Is it too late to consider logging similar to Python's standard logging module? It provides a high degree of configuration with levels, filters, handlers (File, Stdout, Syslog, etc), and an hierarchical logging system. I've done this once in nodejs, and would take this up as well if it seems like a good idea. |
It's not too late at all. I feel like the current logging is very nice, if On Wed, Jan 22, 2014 at 1:06 AM, Sean McArthur [email protected]:
|
@alexcrichton is there a nice way to access the crate map from non-libstd? On Wed, Jan 22, 2014 at 2:02 AM, Corey Richardson [email protected] wrote:
|
The format of the crate map is defined in libstd, and I wouldn't recommend interfacing with it from non-rust code. It can be inspected through |
I like the logging macros, they allow for library authors to easily use Should I start with an RFC, or just send a pull request?
|
If you've got some code ready, feel free to send it in, but you may want to ask around for opinions on what sort of features are desired by such a library. We do have the ability to change the sink of logging macros, but it sounds like you're looking for something a little more involved than that? |
I'm looking for something like Python's logging: easy to log things, since it's built-in, all libraries can agree on a logging framework, because it's also extensible so that any app developers can chose exaclty what logs they see and where they go to. Here's an example in Python: import logging
logging.configure({
'handlers': {
'file': {
'class': 'logging.FileHandler',
'file': '/var/log/myapp.log'
},
'email': {
'class': 'logging.EmailHandler',
'level': 'ERROR',
// from, to, etc
}
},
'loggers': {
'myapp': {
'level': 'INFO',
'handlers': ['file', 'email']
},
'mysql2': {
'level': 'ERROR',
'handlers': ['file']
}
}
}) As an app developer, I can say I want For Rust, I'd say keep the macros: // mysql2.rs
debug!("QUERY {}", query); And in my app, I could do something like this: // myapp.rs
logging!(
handlers: {
stdout: std::logging::handlers::Stdout::new(),
logly: myapp::logging::Logly::new()
}
loggers: {
myapp: {},
mysql2: {}
}
); |
It sounds like this is all possible to do today. The It doesn't sound likes it's easy to do that, though! I would err more on the side of wrapper structs that implement |
Pieces missing are a timestamp on the log record, though I suppose a wrapping logger could insert one, and the
|
Sadly right now we don't have a fantastic time abstraction in libstd, but you can certainly implement something like this with libextra's time module plus an implementation of the |
cc @flaper87 |
With the new regex crate, the environment variable could now possibly take a regular expression as well. |
It's seems like it would be somewhat harder to define the precedence of the I guess we could just do it based on the order in which the directives are specified (unfortunately, it seems like using regexes might also be harder to get to be efficient... but maybe this doesn't matter so much). |
Hello folks, I'm trying to figure out the Rust logging system and got some questions and I. Outputing.
By default, logging is performed to the stderr output of the process. It's a Moreover, even if I spawn a task using TaskBuilder with custom stderr set upon
Hence, the only way to redirect the logging is using set_logger function. The
Personally, I like the idea that logging is connected to stderr. It seems to How about outputing logs to multiple sinks? I thought about possibility to set II. Miscs.
Is logging system always going to be hiden inside phase plugin directive? Or
I saw that log! macro is creating a static LogLocation struct. Does it mean I think that's all that comes to my mind for now. Any answers will be highly |
|
Closing, liblog has moved out of the distribution and almost all linked bugs here are fixed. Redesigns (like rust-lang/log#3) can easily happen out of tree, and discussion should probably continue on the liblog issue tracker. |
Test windows random shims This adds tests for `BCryptGenRandom` and `RtlGenRandom` (aka `SystemFunction036`). Note that `BCryptGenRandom` comes in two flavours: ```rust BCryptGenRandom(null_mut(), key.as_mut_ptr(), len, BCRYPT_USE_SYSTEM_PREFERRED_RNG) BCryptGenRandom(BCRYPT_RNG_ALG_HANDLE, key.as_mut_ptr(), len, 0) ``` Fixes rust-lang#3308
Part of rust-lang#2279 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Zyad Hassan <[email protected]>
It is quite old and primitive at this stage, being mostly implemented in the runtime. With our new-found Rustic powers we should be able to come up with a more robust design.
Sub-bugs to handle along the way:
RUST_LOG=error
should turn on error-level logging for all modules #6033 turning on everything with RUST_LOG=errorThe text was updated successfully, but these errors were encountered: