mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
main: add --syslog-tag option to crosvm
This mirrors the functionality of the `crosvm run --syslog-tag` option that we already have; the long-term goal is to remove the run-specific option and use the top-level argument instead, but we will keep both for compatibility until downstream projects have migrated. Moving the option to the top level arguments will let us initialize logging earlier once the run option is dropped. BUG=b:240578830 TEST=crosvm --syslog-tag TEST run bzImage # observe TEST in syslog Change-Id: Ie7ff8dc8e43a13b11641fcefd12b40ecf339970b Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3792427 Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Noah Gold <nkgold@google.com> Tested-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
03356743aa
commit
eb5c3dae7a
2 changed files with 4 additions and 0 deletions
|
@ -106,6 +106,9 @@ pub struct CrosvmCmdlineArgs {
|
|||
#[argh(option, default = r#"String::from("info")"#)]
|
||||
/// specify log level, eg "off", "error", "debug,disk=off", etc
|
||||
pub log_level: String,
|
||||
#[argh(option, arg_name = "TAG")]
|
||||
/// when logging to syslog, use the provided tag
|
||||
pub syslog_tag: Option<String>,
|
||||
#[argh(switch)]
|
||||
/// disable output to syslog
|
||||
pub no_syslog: bool,
|
||||
|
|
|
@ -507,6 +507,7 @@ fn crosvm_main() -> Result<CommandStatus> {
|
|||
|
||||
let mut log_config = LogConfig {
|
||||
filter: &args.log_level,
|
||||
proc_name: args.syslog_tag.unwrap_or("crosvm".to_string()),
|
||||
syslog: !args.no_syslog,
|
||||
..Default::default()
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue