Skip to content

Use tracing::{debug,info,warn,error} instead of (e)println! in flatsync-cli

easonqq0000 requested to merge easonqq0000/flatsync:main into main

Describe the feature

Replace (e)println! with log in cli

eason@flatsync:~/Documents/project/flatsync$ cargo run -p flatsync-cli -- -v init
   Compiling flatsync-cli v0.1.0 (/home/eason/Documents/project/flatsync/flatsync-cli)
    Finished dev [unoptimized + debuginfo] target(s) in 3.00s
     Running `target/debug/flatsync-cli -v init`
Initializing FlatSync daemon    
Please install FlatSync as a GitHub app to your account **first** by following this link: "https://github.com/apps/flatsync/installations/new".
This is required because GitHub's API doesn't allow us to interact with Gists without additional permission via a GitHub App installation.    
Afterwards, please visit "https://github.com/login/device" and enter the following code: "BB8A-2C7F"

Describe your changes

First, I add verbose cli option.

Second, I use tracing and filter out log that

  1. From other crate
  2. level of verbosity lower than WARN(INFO if verbose is set)

Also of note I use log::info instead of tracing::info so we could use other logging crate if we decided not to use tracing.

Explain if there are uncompleted places

If there is a ERROR message from other crate, it wouldn't get printed.

Merge request reports