mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
OHOS: Use new file logger. (#37690)
Hilog 0.2.1 allows us to additionally log to a file. This is sometimes more convinient when benchmarking. Also added the new log domain of `script::dom::console`. Testing: Tested on device. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
25a5f079ff
commit
6656a09f8c
5 changed files with 30 additions and 3 deletions
|
@ -62,6 +62,10 @@ pub(crate) struct ServoShellPreferences {
|
|||
/// If a filter is passed, the logger should adjust accordingly.
|
||||
#[cfg(target_env = "ohos")]
|
||||
pub log_filter: Option<String>,
|
||||
|
||||
/// Log also to a file
|
||||
#[cfg(target_env = "ohos")]
|
||||
pub log_to_file: bool,
|
||||
}
|
||||
|
||||
impl Default for ServoShellPreferences {
|
||||
|
@ -82,6 +86,8 @@ impl Default for ServoShellPreferences {
|
|||
userscripts_directory: None,
|
||||
#[cfg(target_env = "ohos")]
|
||||
log_filter: None,
|
||||
#[cfg(target_env = "ohos")]
|
||||
log_to_file: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -363,6 +369,13 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
|
|||
"FILTER",
|
||||
);
|
||||
|
||||
#[cfg(target_env = "ohos")]
|
||||
opts.optflag(
|
||||
"",
|
||||
"log-to-file",
|
||||
"Also log to a file (/data/app/el2/100/base/org.servo.servo/cache/servo.log)",
|
||||
);
|
||||
|
||||
opts.optflag(
|
||||
"",
|
||||
"enable-experimental-web-platform-features",
|
||||
|
@ -435,6 +448,9 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
|
|||
log_filter
|
||||
};
|
||||
|
||||
#[cfg(target_env = "ohos")]
|
||||
let log_to_file = opt_match.opt_present("log-to-file");
|
||||
|
||||
let mut debug_options = DebugOptions::default();
|
||||
for debug_string in opt_match.opt_strs("Z") {
|
||||
if let Err(e) = debug_options.extend(debug_string) {
|
||||
|
@ -648,6 +664,8 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
|
|||
.map(PathBuf::from),
|
||||
#[cfg(target_env = "ohos")]
|
||||
log_filter,
|
||||
#[cfg(target_env = "ohos")]
|
||||
log_to_file,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue