-
Notifications
You must be signed in to change notification settings - Fork 346
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
Add debug flag #465
Add debug flag #465
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,11 @@ use nix::unistd::getuid; | |
#[derive(Parser, Debug)] | ||
#[clap(version = crate_version!(), author = "youki team")] | ||
struct Opts { | ||
// I don't know how to get the log level when the --debug flag is not set (I want to show some default values on the help page when the options are not set) | ||
// Example: '--debug change log level to debug. (default: "warn")' | ||
/// change log level to debug. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These comments in this section are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These codes may be helpful for you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The default value in some options is dynamic, for example, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @unknowndevQwQ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Should I delete L41-L42? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
#[clap(long)] | ||
debug: bool, | ||
yihuaf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#[clap(short, long)] | ||
log: Option<PathBuf>, | ||
#[clap(long)] | ||
|
@@ -104,7 +109,7 @@ fn main() -> Result<()> { | |
|
||
let opts = Opts::parse(); | ||
|
||
if let Err(e) = crate::logger::init(opts.log, opts.log_format) { | ||
if let Err(e) = crate::logger::init(opts.debug, opts.log, opts.log_format) { | ||
eprintln!("log init failed: {:?}", e); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YOUKI_LOG_LEVEL=o sudo -E ./youki/target/x86_64-unknown-linux-gnu/release/youki state test
Is it normal to continue doing other things after a loglevel failure?