mirror of
https://github.com/servo/servo.git
synced 2025-09-27 15:20:09 +01:00
Add cli option for tracing-filter (#35370)
Using environment variables is not really an option on ohos/android, so add a CLI option to configure tracing. Making it a `pref`, so that we can persist the filter might also be desirable. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
39c1e5d5d6
commit
654df4c8b7
5 changed files with 44 additions and 8 deletions
|
@ -37,6 +37,11 @@ pub(crate) struct ServoShellPreferences {
|
|||
/// Whether or not to run servoshell in headless mode. While running in headless
|
||||
/// mode, image output is supported.
|
||||
pub headless: bool,
|
||||
/// Filter directives for our tracing implementation.
|
||||
///
|
||||
/// Overrides directives specified via `SERVO_TRACING` if set.
|
||||
/// See: <https://docs.rs/tracing-subscriber/0.3.19/tracing_subscriber/filter/struct.EnvFilter.html#directives>
|
||||
pub tracing_filter: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for ServoShellPreferences {
|
||||
|
@ -50,6 +55,7 @@ impl Default for ServoShellPreferences {
|
|||
no_native_titlebar: true,
|
||||
searchpage: "https://duckduckgo.com/html/?q=%s".into(),
|
||||
headless: false,
|
||||
tracing_filter: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,6 +317,13 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
|
|||
"Set custom user agent string (or ios / android / desktop for platform default)",
|
||||
"NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)",
|
||||
);
|
||||
opts.optmulti(
|
||||
"",
|
||||
"tracing-filter",
|
||||
"Define a custom filter for traces. Overrides `SERVO_TRACING` if set.",
|
||||
"FILTER",
|
||||
);
|
||||
|
||||
opts.optmulti(
|
||||
"",
|
||||
"pref",
|
||||
|
@ -353,6 +366,13 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
|
|||
if let Some(content_process) = opt_match.opt_str("content-process") {
|
||||
return ArgumentParsingResult::ContentProcess(content_process);
|
||||
}
|
||||
// Env-Filter directives are comma seperated.
|
||||
let filters = opt_match.opt_strs("tracing-filter").join(",");
|
||||
let tracing_filter = if filters.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(filters)
|
||||
};
|
||||
|
||||
let mut debug_options = DebugOptions::default();
|
||||
for debug_string in opt_match.opt_strs("Z") {
|
||||
|
@ -544,6 +564,7 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
|
|||
device_pixel_ratio_override,
|
||||
clean_shutdown: opt_match.opt_present("clean-shutdown"),
|
||||
headless: opt_match.opt_present("z"),
|
||||
tracing_filter,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue