ohos: Add default log filter (#32760)

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
This commit is contained in:
Jonathan Schwender 2024-07-12 06:12:25 +02:00 committed by GitHub
parent 496ce717c5
commit b206a0f4a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 0 deletions

1
Cargo.lock generated
View file

@ -5794,6 +5794,7 @@ dependencies = [
"egui",
"egui-winit",
"egui_glow",
"env_filter",
"euclid",
"getopts",
"gilrs",

View file

@ -77,6 +77,7 @@ webxr = { git = "https://github.com/servo/webxr" }
backtrace = { workspace = true }
[target.'cfg(target_env = "ohos")'.dependencies]
env_filter = "0.1.0"
# force inprocess, until libc-rs 0.2.156 is released containing
# https://github.com/rust-lang/libc/commit/9e248e212c5602cb4e98676e4c21ea0382663a12
ipc-channel = { workspace = true, features = ["force-inprocess"] }

View file

@ -325,6 +325,23 @@ fn initialize_logging_once() {
static ONCE: Once = Once::new();
ONCE.call_once(|| {
let mut builder = hilog::Builder::new();
let filters = [
"fonts",
"servo",
"servoshell",
"servoshell::egl:gl_glue",
// Show JS errors by default.
"script::dom::bindings::error",
// Show GL errors by default.
"canvas::webgl_thread",
"compositing::compositor",
"constellation::constellation",
];
let mut filter_builder = env_filter::Builder::new();
for &module in &filters {
filter_builder.filter_module(module, log::LevelFilter::Debug);
}
builder.filter_level(LevelFilter::Debug).init();
info!("Servo Register callback called!");