Comments (4)
As suggested on reddit we could put the timestamp first in the format so that single-line log messages can be more naturally sorted by time.
from env_logger.
I like moving everything into brackets but dislike the 3 character abbreviations. I think padding info/warn is best. Saving 1-2 characters doesn't help output size much but seems to impede readability a fair bit. ERR
/DBG
are intuitive but INF
/WRN
are not.
Time first also seems preferable for sorting.
As an aside, I originally came to complain because the docs currently imply the output is not well aligned for different log levels, which would be highly preferable.
from env_logger.
I find the 3 letter abbreviations fairly intuitive, I think they're fairly common, but don't have super strong opinions about them. Here's how the format looks with the timestamp at the front and the log levels expanded:
I've got a PR that implements this, but I think I'll leave it open for a while so there's plenty of time for feedback.
from env_logger.
Based on some discussion on reddit, I think env_logger
's default format will optimise for ad-hoc analysis, like physically eyeballing the output or once-off text processing tasks. The default format won't optimise for long-term stability, and explicitly makes no guarantees about the stability of its output across major, minor or patch version bumps during 0.x
.
If you want to rely on a specific format for log records then you need to state what that format is. Otherwise things will change, and that's the case whether you explicitly opt-in to a new version of env_logger
or not. This sort of implicit coupling is problematic for systems in the long-term because they're difficult to reason about. Changes can be introduced in ways that are non-obvious. So env_logger
's docs will call out that the default format is not truly stable and offer examples of how folks can go about making a format dependable if they need it. By 1.x
, we should offer an easy way to opt-in to some arbitrary stable format.
The alternative option would be to completely freeze the default format, since log records may be captured and persisted. If the format changes then the complete set of persisted log files might use multiple formats. This option is not ideal because it makes improvements to either log
or env_logger
much harder to discover.
Over time the default format will settle and probably not need to change much after 1.x
anyway. Even if that's the case we should explicitly not encourage depending on the shape of the default format.
We should also revisit this before 1.x
. By then we might want to limit format changes to at least minor version bumps.
from env_logger.
Related Issues (20)
- Is this library thread-safe? HOT 5
- Add function() to Record HOT 1
- MSRV break due to is_terminal 0.4.8 HOT 1
- `WriteStyle` is ignored when used with `Target::Pipe`
- Replace is-terminal dep with std::io::IsTerminal HOT 7
- `Target::Pipe` does not auto-flush like std{out/err}
- about doc HOT 2
- Cargo.lock is not meant to be checked in for libraries HOT 4
- Trivial: the systemd example misuses RUST_LOG_STYLE HOT 1
- method not found in `&mut Formatter` HOT 1
- can't see any logs when using #[windows_subsystem = "windows"] HOT 4
- Missing changelog for 0.10.1 HOT 1
- Remove deprecated APIs
- Missing recent releases on github? HOT 1
- logger crate catches Clion stop signal HOT 1
- Provide a way to disable automatic flushing when using `Target::Pipe` HOT 1
- Feature Deprecation Without Warning or Migration HOT 3
- env_logger doesn't output anything HOT 4
- Issue with `anstream` optional dependency HOT 1
- Empty changelog for 0.11.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from env_logger.