Skip to content

Commit

Permalink
cleaner output by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mgree committed Jun 18, 2021
1 parent dac87cb commit bcd2609
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
PATH="$(pwd)/target/debug:$PATH"
cd tests
for test in *.sh
RUST_LOG="ffs=info"
export RUST_LOG
do
echo ========== RUNNING TEST: $(basename ${test%*.sh})
./${test} || exit 1
Expand Down
12 changes: 11 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ fn main() {
.version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS"))
.about("file fileystem")
.arg(
Arg::with_name("DEBUG")
.help("Give debug output on stderr")
.long("debug")
.short("d")
)
.arg(
Arg::with_name("AUTOUNMOUNT")
.help("Automatically unmount the filesystem when the mounting process exits")
Expand Down Expand Up @@ -106,7 +112,11 @@ fn main() {
let mut config = Config::default();

let filter_layer = EnvFilter::try_from_default_env().unwrap_or_else(|_e| {
EnvFilter::from_default_env().add_directive("ffs=debug".parse().unwrap())
if args.is_present("DEBUG") {
EnvFilter::new("ffs=debug")
} else {
EnvFilter::new("ffs=warn")
}
});
let fmt_layer = fmt::layer().with_writer(std::io::stderr);
tracing_subscriber::registry()
Expand Down

0 comments on commit bcd2609

Please sign in to comment.