[snowpatch] [PATCH V2 0/3] Logging support
Russell Currey
ruscur at russell.cc
Wed Jun 15 14:42:04 AEST 2016
This series adds logging to snowpatch. I have decided to go with
env_logger, since it seems fairly ubiquitous, and it is simple.
Logging can be configured with an environment variable, RUST_LOG, with
the values "trace", "debug", "info", "warn", and "error". We will
probably want to change this in the future, but it is not too important.
The important thing is that we start using these macros now. They are
part of Rust's generic logging interface. We can change implementations
at any time relatively easily, but we can get rid of println today. That
said, I believe in long-running settings that snowpatch should log to
stdout and be managed as an init system service, so I doubt we'll get rid
of it.
The macros are: !trace !debug !info !warn !error
There is also !log, which uses the default level, which I think we should
avoid.
Some fancy stuff can be provided by env_logger in terms of which module is
logged with what verbosity, which might be useful. Read about that here:
https://rust-lang-nursery.github.io/log/env_logger/index.html
V2: Set a sane default and add logging support
Russell Currey (3):
Add env_logger and update dependencies
Replace print messages with appropriate logging
docs: Add documentation for logging
Cargo.lock | 64 ++++++++++++++++++++++++++++++++------------------------
Cargo.toml | 6 ++++--
docs/logging.md | 21 +++++++++++++++++++
src/git.rs | 4 ++--
src/main.rs | 59 +++++++++++++++++++++++++++++++++++++++------------
src/patchwork.rs | 7 ++++---
src/settings.rs | 2 +-
7 files changed, 115 insertions(+), 48 deletions(-)
create mode 100644 docs/logging.md
--
2.8.3
More information about the snowpatch
mailing list