Replaced `log` with `tracing`.
This commit is contained in:
parent
ed6b4d9bea
commit
5101fd74e6
|
@ -36,19 +36,19 @@ zero-ui-core = { path = "zero-ui-core" }
|
|||
# util
|
||||
paste = "1"
|
||||
retain_mut = "0.1"
|
||||
log = "0.4"
|
||||
tracing = "0.1"
|
||||
bitflags = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
bencher = "0.1"
|
||||
meval = "0.2"
|
||||
trybuild = "1"
|
||||
log = "0.4"
|
||||
image = "0.23"
|
||||
# enable test util
|
||||
zero-ui-core = { path = "zero-ui-core", features = ["test_util"] }
|
||||
zero-ui-view = { path = "zero-ui-view" }
|
||||
zero-ui-view-prebuilt = { path = "zero-ui-view-prebuilt" }
|
||||
examples-util = { path = "examples/util" }
|
||||
|
||||
[workspace]
|
||||
members = ["zero-ui-view-api", "zero-ui-view", "zero-ui-view-prebuilt", "zero-ui-proc-macros", "zero-ui-core"]
|
||||
|
|
|
@ -4,6 +4,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -6,6 +6,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -4,6 +4,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -5,6 +5,7 @@ use zero_ui_core::focus::FocusChangedEvent;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -4,6 +4,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -4,6 +4,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -3,6 +3,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -6,6 +6,7 @@ use zero_ui::widgets::image::properties::{image_error_view, image_loading_view,
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
@ -25,7 +26,7 @@ fn app_main() {
|
|||
|
||||
// Set a error view generator used in all images in this window.
|
||||
image_error_view = view_generator!(|_, args: ImageErrorArgs| {
|
||||
log::error!(target: "expected", "{}", args.error);
|
||||
tracing::error!(target: "expected", "{}", args.error);
|
||||
text! {
|
||||
text = args.error;
|
||||
margin = 20;
|
||||
|
@ -218,7 +219,7 @@ fn large_image() -> impl Widget {
|
|||
loading_view = ViewGenerator::new(image_loading);
|
||||
limits = Some(ImageLimits { max_encoded_size: 300.megabytes(), max_decoded_size: 3.gigabytes() });
|
||||
on_error = hn!(|_, args: &ImageErrorArgs| {
|
||||
log::error!(target: "unexpected", "{}", args.error);
|
||||
tracing::error!(target: "unexpected", "{}", args.error);
|
||||
})
|
||||
};
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
zero_ui_view::init();
|
||||
App::default().run_window(|_| {
|
||||
window! {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
use zero_ui::prelude::*;
|
||||
|
||||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
//use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
zero_ui_view::run_same_process(app_main);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ use zero_ui::{prelude::*, widgets::text::properties::TextColorVar};
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -4,6 +4,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
// zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "examples-util"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.3"
|
|
@ -0,0 +1,31 @@
|
|||
use tracing::{Level, Subscriber};
|
||||
use tracing_subscriber::{layer::Layer, prelude::*};
|
||||
|
||||
/// Prints `tracing` and `log` events of level INFO and above.
|
||||
pub fn print_info() {
|
||||
tracing_subscriber::registry()
|
||||
.with(CustomFilter)
|
||||
.with(tracing_subscriber::fmt::layer().without_time().pretty())
|
||||
.init();
|
||||
}
|
||||
|
||||
struct CustomFilter;
|
||||
impl<S: Subscriber> Layer<S> for CustomFilter {
|
||||
fn enabled(&self, metadata: &tracing::Metadata<'_>, _: tracing_subscriber::layer::Context<'_, S>) -> bool {
|
||||
if metadata.level() > &Level::INFO {
|
||||
return false;
|
||||
}
|
||||
|
||||
// suppress webrender vertex debug-only warnings.
|
||||
// see: https://bugzilla.mozilla.org/show_bug.cgi?id=1615342
|
||||
if metadata.target() == "webrender::device::gl" && metadata.line() == Some(2331) {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
fn max_level_hint(&self) -> Option<tracing::metadata::LevelFilter> {
|
||||
Some(tracing::metadata::LevelFilter::INFO)
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ use zero_ui::prelude::*;
|
|||
use zero_ui_view_prebuilt as zero_ui_view;
|
||||
|
||||
fn main() {
|
||||
examples_util::print_info();
|
||||
//zero_ui_view::run_same_process(app_main);
|
||||
|
||||
zero_ui_view::init();
|
||||
|
|
|
@ -220,7 +220,12 @@ fn run(mut args: Vec<&str>) {
|
|||
let rust_flags = release_rust_flags(release);
|
||||
let rust_flags = &[(rust_flags.0, rust_flags.1.as_str()), trace];
|
||||
let release = if release { "--release" } else { "" };
|
||||
cmd_env("cargo", &["run", "--features", "app_profiler", release, "--example"], &args, rust_flags);
|
||||
cmd_env(
|
||||
"cargo",
|
||||
&["run", "--features", "app_profiler", release, "--example"],
|
||||
&args,
|
||||
rust_flags,
|
||||
);
|
||||
} else if let Some(&"*") = args.first() {
|
||||
args.remove(0);
|
||||
let release = args.contains(&"--release");
|
||||
|
|
|
@ -69,7 +69,7 @@ ego-tree = "0.6"
|
|||
retain_mut = "0.1"
|
||||
once_cell = "1"
|
||||
byteorder = "1"
|
||||
log = "0.4"
|
||||
tracing = "0.1"
|
||||
unsafe-any = "0.4"
|
||||
linear-map = "1"
|
||||
rand = "0.8"
|
||||
|
|
|
@ -461,11 +461,6 @@ event! {
|
|||
/// A view-process must be initialized before creating an app. Panics on `run` if there is
|
||||
/// not view-process, also panics if the current process is executing as a view-process.
|
||||
///
|
||||
/// # Debug Log
|
||||
///
|
||||
/// In debug builds, `App` sets a [`logger`](log) that prints info, warning and error logs to `stderr`
|
||||
/// if no logger was registered before the call to [`blank`] or [`default`].
|
||||
///
|
||||
/// [`blank`]: App::blank
|
||||
/// [`default`]: App::default
|
||||
pub struct App;
|
||||
|
@ -533,7 +528,6 @@ impl App {
|
|||
/// Application without any extension and without device events.
|
||||
pub fn blank() -> AppExtended<Vec<Box<dyn AppExtensionBoxed>>> {
|
||||
assert_not_view_process();
|
||||
DebugLogger::init();
|
||||
AppExtended {
|
||||
extensions: vec![],
|
||||
view_process_exe: None,
|
||||
|
@ -1878,63 +1872,6 @@ mod headless_tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
struct DebugLogger;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
impl DebugLogger {
|
||||
fn init() {
|
||||
// init debug logger if no other logger was already used.
|
||||
if log::set_logger(&DebugLogger).is_ok() {
|
||||
log::set_max_level(log::LevelFilter::Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
impl log::Log for DebugLogger {
|
||||
fn enabled(&self, metadata: &log::Metadata) -> bool {
|
||||
metadata.level() <= log::Level::Info
|
||||
}
|
||||
|
||||
fn log(&self, record: &log::Record) {
|
||||
if self.enabled(record.metadata()) {
|
||||
use colored::*;
|
||||
let mut level = None;
|
||||
match record.metadata().level() {
|
||||
log::Level::Error => {
|
||||
level = Some("error".bright_red().bold());
|
||||
}
|
||||
log::Level::Warn => {
|
||||
// suppress webrender vertex debug-only warnings.
|
||||
// see: https://bugzilla.mozilla.org/show_bug.cgi?id=1615342
|
||||
if record.target() == "webrender::device::gl" || record.line() == Some(2331) {
|
||||
return;
|
||||
}
|
||||
|
||||
level = Some("warn".bright_yellow().bold());
|
||||
}
|
||||
log::Level::Info => {
|
||||
level = Some("info".bright_blue().bold());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some(level) = level {
|
||||
match record.file() {
|
||||
Some(file) => {
|
||||
eprintln!("{}: [{}:{}] {}", level, file, record.line().unwrap_or(1), record.args())
|
||||
}
|
||||
None => {
|
||||
eprintln!("{}: [{}] {}", level, record.target(), record.args())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn flush(&self) {}
|
||||
}
|
||||
|
||||
unique_id_64! {
|
||||
/// Unique identifier of a device event source.
|
||||
pub struct DeviceId;
|
||||
|
|
|
@ -137,7 +137,7 @@ pub fn next_id32(next: &'static AtomicU32) -> NonZeroU32 {
|
|||
let id = next.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
if id == 0 {
|
||||
log::error!("id generator reached `u64::MAX`, will start reusing");
|
||||
tracing::error!("id generator reached `u64::MAX`, will start reusing");
|
||||
} else {
|
||||
let id = hash32(id);
|
||||
if let Some(id) = NonZeroU32::new(id) {
|
||||
|
@ -153,7 +153,7 @@ pub fn next_id64(next: &'static AtomicU64) -> NonZeroU64 {
|
|||
let id = next.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
if id == 0 {
|
||||
log::error!("id generator reached `u64::MAX`, will start reusing");
|
||||
tracing::error!("id generator reached `u64::MAX`, will start reusing");
|
||||
} else {
|
||||
// remove the sequential clustering.
|
||||
let id = splitmix64(id);
|
||||
|
|
|
@ -651,7 +651,7 @@ where
|
|||
handler(ctx, args);
|
||||
handler_args.handle.unsubscribe();
|
||||
} else {
|
||||
log::error!("`app_hn_once!` called after requesting unsubscribe");
|
||||
tracing::error!("`app_hn_once!` called after requesting unsubscribe");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ where
|
|||
}
|
||||
}
|
||||
} else {
|
||||
log::error!("`async_app_hn_once!` called after requesting unsubscribe");
|
||||
tracing::error!("`async_app_hn_once!` called after requesting unsubscribe");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -512,7 +512,7 @@ impl Images {
|
|||
}
|
||||
|
||||
if self.view.is_none() && !self.load_in_headless {
|
||||
log::warn!("loading dummy image, set `load_in_headless=true` to actually load without renderer");
|
||||
tracing::warn!("loading dummy image, set `load_in_headless=true` to actually load without renderer");
|
||||
|
||||
let dummy = var(Image::new(ViewImage::dummy(None)));
|
||||
self.cache.insert(
|
||||
|
@ -1029,7 +1029,7 @@ impl crate::render::Image for Image {
|
|||
let namespace = match renderer.namespace_id() {
|
||||
Ok(n) => n,
|
||||
Err(Respawned) => {
|
||||
log::debug!("respawned calling `namespace_id`, will return DUMMY");
|
||||
tracing::debug!("respawned calling `namespace_id`, will return DUMMY");
|
||||
return ImageKey::DUMMY;
|
||||
}
|
||||
};
|
||||
|
@ -1041,13 +1041,13 @@ impl crate::render::Image for Image {
|
|||
let key = match renderer.use_image(self.view.get().unwrap()) {
|
||||
Ok(k) => {
|
||||
if k == ImageKey::DUMMY {
|
||||
log::error!("received DUMMY from `use_image`");
|
||||
tracing::error!("received DUMMY from `use_image`");
|
||||
return k;
|
||||
}
|
||||
k
|
||||
}
|
||||
Err(Respawned) => {
|
||||
log::debug!("respawned `add_image`, will return DUMMY");
|
||||
tracing::debug!("respawned `add_image`, will return DUMMY");
|
||||
return ImageKey::DUMMY;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -666,7 +666,7 @@ impl MouseManager {
|
|||
// mouse_enter/mouse_leave.
|
||||
self.update_hovered(window_id, Some(device_id), hits, Some(target), ctx.events, ctx.services.mouse());
|
||||
} else {
|
||||
log::warn!("RawCursorMoved did not actually move")
|
||||
tracing::warn!("RawCursorMoved did not actually move")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1599,12 +1599,12 @@ impl FrameInfoBuilder {
|
|||
|
||||
#[cfg(debug_assertions)]
|
||||
for (widget_id, repeats) in repeats {
|
||||
log::error!(target: "render", "widget id `{:?}` appears more then once in {:?}:FrameId({}){}",
|
||||
tracing::error!(target: "render", "widget id `{:?}` appears more then once in {:?}:FrameId({}){}",
|
||||
widget_id, self.window_id, self.frame_id.get(), {
|
||||
let mut places = String::new();
|
||||
use std::fmt::Write;
|
||||
for node in repeats {
|
||||
let info = WidgetInfo::new(&r, node);
|
||||
for node in &repeats {
|
||||
let info = WidgetInfo::new(&r, *node);
|
||||
write!(places, "\n {}", info.path()).unwrap();
|
||||
}
|
||||
places
|
||||
|
|
|
@ -262,7 +262,7 @@ where
|
|||
}
|
||||
}));
|
||||
if let Err(p) = r {
|
||||
log::error!("panic in `task::spawn`: {}", panic_str(&p));
|
||||
tracing::error!("panic in `task::spawn`: {}", panic_str(&p));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -607,7 +607,7 @@ where
|
|||
{
|
||||
spawn(async move {
|
||||
if let Err(p) = wait_catch(task).await {
|
||||
log::error!("parallel `spawn_wait` task panicked: {}", panic_str(&p))
|
||||
tracing::error!("parallel `spawn_wait` task panicked: {}", panic_str(&p))
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -494,7 +494,7 @@ impl FontFace {
|
|||
let namespace = match renderer.namespace_id() {
|
||||
Ok(n) => n,
|
||||
Err(Respawned) => {
|
||||
log::debug!("respawned calling `namespace_id`, will return dummy font key");
|
||||
tracing::debug!("respawned calling `namespace_id`, will return dummy font key");
|
||||
return Self::DUMMY_FONT_KEY;
|
||||
}
|
||||
};
|
||||
|
@ -508,7 +508,7 @@ impl FontFace {
|
|||
let key = match renderer.add_font((*self.bytes).clone(), self.face_index) {
|
||||
Ok(k) => k,
|
||||
Err(Respawned) => {
|
||||
log::debug!("respawned calling `add_font`, will return dummy font key");
|
||||
tracing::debug!("respawned calling `add_font`, will return dummy font key");
|
||||
return Self::DUMMY_FONT_KEY;
|
||||
}
|
||||
};
|
||||
|
@ -599,7 +599,7 @@ impl FontFace {
|
|||
.or_insert_with(|| Rc::new(Font::new(Rc::clone(self), font_size, variations)));
|
||||
Rc::clone(f)
|
||||
} else {
|
||||
log::warn!(target: "font_loading", "creating font from unregistered `{}`, will not cache", self.display_name);
|
||||
tracing::warn!(target: "font_loading", "creating font from unregistered `{}`, will not cache", self.display_name);
|
||||
Rc::new(Font::new(Rc::clone(self), font_size, variations))
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ impl Font {
|
|||
let namespace = match renderer.namespace_id() {
|
||||
Ok(n) => n,
|
||||
Err(Respawned) => {
|
||||
log::debug!("respawned calling `namespace_id`, will return dummy font key");
|
||||
tracing::debug!("respawned calling `namespace_id`, will return dummy font key");
|
||||
return Self::DUMMY_FONT_KEY;
|
||||
}
|
||||
};
|
||||
|
@ -700,7 +700,7 @@ impl Font {
|
|||
let key = match renderer.add_font_instance(font_key, self.size, Some(opt), None, variations) {
|
||||
Ok(k) => k,
|
||||
Err(Respawned) => {
|
||||
log::debug!("respawned calling `add_font_instance`, will return dummy font key");
|
||||
tracing::debug!("respawned calling `add_font_instance`, will return dummy font key");
|
||||
return Self::DUMMY_FONT_KEY;
|
||||
}
|
||||
};
|
||||
|
@ -1060,7 +1060,7 @@ impl FontFaceLoader {
|
|||
}
|
||||
|
||||
if r.is_empty() {
|
||||
log::error!(target: "font_loading", "failed to load fallback font");
|
||||
tracing::error!(target: "font_loading", "failed to load fallback font");
|
||||
r.push(Rc::new(FontFace::empty()));
|
||||
}
|
||||
|
||||
|
@ -1109,7 +1109,7 @@ impl FontFaceLoader {
|
|||
return Some(f); // new match
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!(target: "font_loading", "failed to load system font, {}", e);
|
||||
tracing::error!(target: "font_loading", "failed to load system font, {}", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1133,7 +1133,7 @@ impl FontFaceLoader {
|
|||
{
|
||||
Ok(handle) => Some(handle),
|
||||
Err(e) => {
|
||||
log::error!(target: "font_loading", "failed to select system font, {}", e);
|
||||
tracing::error!(target: "font_loading", "failed to select system font, {}", e);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ pub trait Var<T: VarValue>: Clone + IntoVar<T> + crate::private::Sealed + 'stati
|
|||
T: Copy,
|
||||
{
|
||||
if !self.can_update() {
|
||||
log::warn!("`Var::wait_copy` called in a variable that never updates");
|
||||
tracing::warn!("`Var::wait_copy` called in a variable that never updates");
|
||||
}
|
||||
VarCopyNewFut::new(vars, self)
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ pub trait Var<T: VarValue>: Clone + IntoVar<T> + crate::private::Sealed + 'stati
|
|||
#[inline]
|
||||
fn wait_clone<'a, Vw: WithVars>(&'a self, vars: &'a Vw) -> VarCloneNewFut<'a, Vw, T, Self> {
|
||||
if !self.can_update() {
|
||||
log::warn!("`Var::wait_clone` called in a variable that never updates");
|
||||
tracing::warn!("`Var::wait_clone` called in a variable that never updates");
|
||||
}
|
||||
VarCloneNewFut::new(vars, self)
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ pub trait Var<T: VarValue>: Clone + IntoVar<T> + crate::private::Sealed + 'stati
|
|||
#[inline]
|
||||
fn wait_new<'a, Vw: WithVars>(&'a self, vars: &'a Vw) -> VarIsNewFut<'a, Vw, T, Self> {
|
||||
if !self.can_update() {
|
||||
log::warn!("`Var::wait_new` called in a variable that never updates");
|
||||
tracing::warn!("`Var::wait_new` called in a variable that never updates");
|
||||
}
|
||||
VarIsNewFut::new(vars, self)
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ pub mod implicit_base {
|
|||
fn init(&mut self, ctx: &mut WidgetContext) {
|
||||
#[cfg(debug_assertions)]
|
||||
if self.inited {
|
||||
log::error!(target: "widget_base", "`UiNode::init` called in already inited widget {:?}", self.id);
|
||||
tracing::error!(target: "widget_base", "`UiNode::init` called in already inited widget {:?}", self.id);
|
||||
}
|
||||
|
||||
let child = &mut self.child;
|
||||
|
@ -142,7 +142,7 @@ pub mod implicit_base {
|
|||
fn deinit(&mut self, ctx: &mut WidgetContext) {
|
||||
#[cfg(debug_assertions)]
|
||||
if !self.inited {
|
||||
log::error!(target: "widget_base", "`UiNode::deinit` called in not inited widget {:?}", self.id);
|
||||
tracing::error!(target: "widget_base", "`UiNode::deinit` called in not inited widget {:?}", self.id);
|
||||
}
|
||||
|
||||
let child = &mut self.child;
|
||||
|
@ -157,7 +157,7 @@ pub mod implicit_base {
|
|||
fn update(&mut self, ctx: &mut WidgetContext) {
|
||||
#[cfg(debug_assertions)]
|
||||
if !self.inited {
|
||||
log::error!(target: "widget_base", "`UiNode::update` called in not inited widget {:?}", self.id);
|
||||
tracing::error!(target: "widget_base", "`UiNode::update` called in not inited widget {:?}", self.id);
|
||||
}
|
||||
|
||||
let child = &mut self.child;
|
||||
|
@ -167,7 +167,7 @@ pub mod implicit_base {
|
|||
fn event<EU: EventUpdateArgs>(&mut self, ctx: &mut WidgetContext, args: &EU) {
|
||||
#[cfg(debug_assertions)]
|
||||
if !self.inited {
|
||||
log::error!(target: "widget_base", "`UiNode::event::<{}>` called in not inited widget {:?}", std::any::type_name::<EU>(), self.id);
|
||||
tracing::error!(target: "widget_base", "`UiNode::event::<{}>` called in not inited widget {:?}", std::any::type_name::<EU>(), self.id);
|
||||
}
|
||||
|
||||
let child = &mut self.child;
|
||||
|
@ -178,7 +178,7 @@ pub mod implicit_base {
|
|||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if !self.inited {
|
||||
log::error!(target: "widget_base", "`UiNode::measure` called in not inited widget {:?}", self.id);
|
||||
tracing::error!(target: "widget_base", "`UiNode::measure` called in not inited widget {:?}", self.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ pub mod implicit_base {
|
|||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if !self.inited {
|
||||
log::error!(target: "widget_base", "`UiNode::arrange` called in not inited widget {:?}", self.id);
|
||||
tracing::error!(target: "widget_base", "`UiNode::arrange` called in not inited widget {:?}", self.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ pub mod implicit_base {
|
|||
fn render(&self, ctx: &mut RenderContext, frame: &mut FrameBuilder) {
|
||||
#[cfg(debug_assertions)]
|
||||
if !self.inited {
|
||||
log::error!(target: "widget_base", "`UiNode::render` called in not inited widget {:?}", self.id);
|
||||
tracing::error!(target: "widget_base", "`UiNode::render` called in not inited widget {:?}", self.id);
|
||||
}
|
||||
|
||||
ctx.with_widget(self.id, &self.state, |ctx| {
|
||||
|
@ -222,7 +222,7 @@ pub mod implicit_base {
|
|||
fn render_update(&self, ctx: &mut RenderContext, update: &mut FrameUpdate) {
|
||||
#[cfg(debug_assertions)]
|
||||
if !self.inited {
|
||||
log::error!(target: "widget_base", "`UiNode::render_update` called in not inited widget {:?}", self.id);
|
||||
tracing::error!(target: "widget_base", "`UiNode::render_update` called in not inited widget {:?}", self.id);
|
||||
}
|
||||
|
||||
ctx.with_widget(self.id, &self.state, |ctx| {
|
||||
|
|
|
@ -1091,7 +1091,7 @@ impl AppExtension for WindowManager {
|
|||
window.on_resize_event(ctx, args.size);
|
||||
}
|
||||
} else if matches!(args.cause, EventCause::System) {
|
||||
log::warn!("received `RawWindowResizedEvent` with the same size, caused by system");
|
||||
tracing::warn!("received `RawWindowResizedEvent` with the same size, caused by system");
|
||||
// view process is waiting a frame.
|
||||
window.render_empty_update();
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ impl AppExtension for WindowManager {
|
|||
WindowMoveArgs::new(args.timestamp, args.window_id, args.position, args.cause),
|
||||
);
|
||||
} else if matches!(args.cause, EventCause::System) {
|
||||
log::warn!("received `RawWindowMovedEvent` with the same position, caused by system");
|
||||
tracing::warn!("received `RawWindowMovedEvent` with the same position, caused by system");
|
||||
}
|
||||
}
|
||||
} else if let Some(args) = RawWindowStateChangedEvent.update(args) {
|
||||
|
@ -1114,7 +1114,7 @@ impl AppExtension for WindowManager {
|
|||
let prev_state = window.vars.state().copy(ctx.vars);
|
||||
if let EventCause::System = args.cause {
|
||||
if !window.vars.state().set_ne(ctx.vars, args.state) {
|
||||
log::warn!("received `RawWindowStateChangedEvent` with the same state, caused by system");
|
||||
tracing::warn!("received `RawWindowStateChangedEvent` with the same state, caused by system");
|
||||
}
|
||||
}
|
||||
WindowStateChangedEvent.notify(
|
||||
|
@ -1132,7 +1132,7 @@ impl AppExtension for WindowManager {
|
|||
}
|
||||
} else if let Some(args) = RawWindowCloseEvent.update(args) {
|
||||
if ctx.services.windows().windows.contains_key(&args.window_id) {
|
||||
log::error!("view-process closed window without request");
|
||||
tracing::error!("view-process closed window without request");
|
||||
let args = WindowCloseArgs::new(args.timestamp, args.window_id);
|
||||
WindowCloseEvent.notify(ctx, args);
|
||||
}
|
||||
|
@ -1758,7 +1758,7 @@ impl AppWindowInfo {
|
|||
Ok((frame_id, hit_test)) => {
|
||||
return FrameHitInfo::new(self.id, frame_id, point, &hit_test);
|
||||
}
|
||||
Err(Respawned) => log::debug!("respawned calling `hit_test`, will return `no_hits`"),
|
||||
Err(Respawned) => tracing::debug!("respawned calling `hit_test`, will return `no_hits`"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1991,7 +1991,7 @@ impl AppWindow {
|
|||
}
|
||||
if let Some(state) = self.vars.state().copy_new(ctx) {
|
||||
if self.kiosk && !state.is_fullscreen() {
|
||||
log::warn!("kiosk mode blocked state `{:?}`, will remain fullscreen", state);
|
||||
tracing::warn!("kiosk mode blocked state `{:?}`, will remain fullscreen", state);
|
||||
} else {
|
||||
let _: Ignore = w.set_state(state);
|
||||
}
|
||||
|
@ -2173,7 +2173,7 @@ impl AppWindow {
|
|||
|
||||
let mut state = self.vars.state().copy(ctx);
|
||||
if self.kiosk && !state.is_fullscreen() {
|
||||
log::warn!("kiosk mode but not fullscreen, will force to fullscreen");
|
||||
tracing::warn!("kiosk mode but not fullscreen, will force to fullscreen");
|
||||
state = WindowState::Fullscreen;
|
||||
}
|
||||
|
||||
|
@ -2292,7 +2292,7 @@ impl AppWindow {
|
|||
let (size, min_size, max_size) = self.layout_size(ctx, true);
|
||||
|
||||
if size != self.size {
|
||||
log::error!(
|
||||
tracing::error!(
|
||||
"content size does not match window size, expected `{:?}`, but was `{:?}`",
|
||||
self.size,
|
||||
size
|
||||
|
@ -2589,7 +2589,7 @@ impl AppWindow {
|
|||
impl Drop for AppWindow {
|
||||
fn drop(&mut self) {
|
||||
if !self.deinited && !thread::panicking() {
|
||||
log::error!("`AppWindow` dropped without calling `deinit`, no memory is leaked but shared state may be incorrect now");
|
||||
tracing::error!("`AppWindow` dropped without calling `deinit`, no memory is leaked but shared state may be incorrect now");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ parking_lot = "0.11"
|
|||
ipc-channel = "0.15"
|
||||
duct = "0.13"
|
||||
|
||||
log = "0.4"
|
||||
tracing = "0.1"
|
||||
flume = { version = "0.10", default-features = false }
|
||||
bitflags = "1"
|
||||
num-traits = "0.2"
|
||||
|
|
|
@ -173,7 +173,7 @@ impl Controller {
|
|||
Err(e) => {
|
||||
if let Some(p) = process {
|
||||
if let Err(ke) = p.kill() {
|
||||
log::error!(
|
||||
tracing::error!(
|
||||
"failed to kill new view-process after failing to connect to it\n connection error: {:?}\n kill error: {:?}",
|
||||
e,
|
||||
ke
|
||||
|
@ -208,7 +208,7 @@ impl Controller {
|
|||
/// If another disconnect happens during the view-process startup dialog.
|
||||
pub fn handle_disconnect(&mut self, gen: ViewProcessGen) {
|
||||
if gen == self.generation {
|
||||
log::error!(target: "vp_respawn", "channel disconnect, will try respawn");
|
||||
tracing::error!(target: "vp_respawn", "channel disconnect, will try respawn");
|
||||
self.respawn_impl(false)
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ impl Controller {
|
|||
p
|
||||
} else {
|
||||
if self.same_process {
|
||||
log::error!(target: "vp_respawn", "cannot recover in same_process mode");
|
||||
tracing::error!(target: "vp_respawn", "cannot recover in same_process mode");
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
@ -262,14 +262,14 @@ impl Controller {
|
|||
let code_and_output = match process.into_output() {
|
||||
Ok(c) => Some(c),
|
||||
Err(e) => {
|
||||
log::error!(target: "vp_respawn", "view-process could not be heaped, will abandon running, {:?}", e);
|
||||
tracing::error!(target: "vp_respawn", "view-process could not be heaped, will abandon running, {:?}", e);
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
// try print stdout/err and exit code.
|
||||
if let Some(c) = code_and_output {
|
||||
log::info!(target: "vp_respawn", "view-process reaped");
|
||||
tracing::info!(target: "vp_respawn", "view-process reaped");
|
||||
|
||||
let code = c.status.code();
|
||||
|
||||
|
@ -278,14 +278,14 @@ impl Controller {
|
|||
|
||||
#[cfg(windows)]
|
||||
if code == Some(1) {
|
||||
log::warn!(target: "vp_respawn", "view-process exit code is `1`, probably killed by the Task Manager, \
|
||||
tracing::warn!(target: "vp_respawn", "view-process exit code is `1`, probably killed by the Task Manager, \
|
||||
will exit app-process with the same code");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
if code == None {
|
||||
log::warn!(target: "vp_respawn", "view-process exited by signal, probably killed by the user, \
|
||||
tracing::warn!(target: "vp_respawn", "view-process exited by signal, probably killed by the user, \
|
||||
will exit app-process too");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
@ -294,28 +294,28 @@ impl Controller {
|
|||
let code = code.unwrap();
|
||||
|
||||
if !killed_by_us {
|
||||
log::error!(target: "vp_respawn", "view-process exit_code: 0x{:x}", code);
|
||||
tracing::error!(target: "vp_respawn", "view-process exit_code: 0x{:x}", code);
|
||||
}
|
||||
|
||||
match String::from_utf8(c.stderr) {
|
||||
Ok(s) => {
|
||||
if !s.is_empty() {
|
||||
log::error!(target: "vp_respawn", "view-process stderr:\n```stderr\n{}\n```", s)
|
||||
tracing::error!(target: "vp_respawn", "view-process stderr:\n```stderr\n{}\n```", s)
|
||||
}
|
||||
}
|
||||
Err(e) => log::error!(target: "vp_respawn", "failed to read view-process stderr: {}", e),
|
||||
Err(e) => tracing::error!(target: "vp_respawn", "failed to read view-process stderr: {}", e),
|
||||
}
|
||||
|
||||
match String::from_utf8(c.stdout) {
|
||||
Ok(s) => {
|
||||
if !s.is_empty() {
|
||||
log::info!(target: "vp_respawn", "view-process stdout:\n```stdout\n{}\n```", s)
|
||||
tracing::info!(target: "vp_respawn", "view-process stdout:\n```stdout\n{}\n```", s)
|
||||
}
|
||||
}
|
||||
Err(e) => log::error!(target: "vp_respawn", "failed to read view-process stdout: {}", e),
|
||||
Err(e) => tracing::error!(target: "vp_respawn", "failed to read view-process stdout: {}", e),
|
||||
}
|
||||
} else {
|
||||
log::error!(target: "vp_respawn", "failed to reap view-process, will abandon it running and spawn a new one");
|
||||
tracing::error!(target: "vp_respawn", "failed to reap view-process, will abandon it running and spawn a new one");
|
||||
}
|
||||
|
||||
// recover event listener closure (in a box).
|
||||
|
@ -330,12 +330,12 @@ impl Controller {
|
|||
match Self::spawn_view_process(&self.view_process_exe, self.headless) {
|
||||
Ok(r) => break r,
|
||||
Err(e) => {
|
||||
log::error!(target: "vp_respawn", "failed to respawn, {:?}", e);
|
||||
tracing::error!(target: "vp_respawn", "failed to respawn, {:?}", e);
|
||||
retries -= 1;
|
||||
if retries == 0 {
|
||||
panic!("failed to respawn `view-process` after 3 retries");
|
||||
}
|
||||
log::info!(target: "vp_respawn", "retrying respawn");
|
||||
tracing::info!(target: "vp_respawn", "retrying respawn");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ crate-type = ["lib", "cdylib"]
|
|||
[dependencies]
|
||||
zero-ui-view-api = { path = "../zero-ui-view-api" }
|
||||
webrender = { path = "../dependencies/webrender/webrender" }
|
||||
log = "0.4"
|
||||
tracing = "0.1"
|
||||
gleam = "0.13.1"
|
||||
glutin = "0.27"
|
||||
flume = "0.10"
|
||||
|
|
|
@ -57,7 +57,7 @@ pub fn text_aa() -> TextAntiAliasing {
|
|||
let mut smoothing_type: u32 = 0;
|
||||
|
||||
if SystemParametersInfoW(SPI_GETFONTSMOOTHING, 0, &mut enabled as *mut _ as *mut _, 0) == 0 {
|
||||
log::error!("SPI_GETFONTSMOOTHING error: {:X}", GetLastError());
|
||||
tracing::error!("SPI_GETFONTSMOOTHING error: {:X}", GetLastError());
|
||||
return TextAntiAliasing::Mono;
|
||||
}
|
||||
if enabled == 0 {
|
||||
|
@ -65,7 +65,7 @@ pub fn text_aa() -> TextAntiAliasing {
|
|||
}
|
||||
|
||||
if SystemParametersInfoW(SPI_GETFONTSMOOTHINGTYPE, 0, &mut smoothing_type as *mut _ as *mut _, 0) == 0 {
|
||||
log::error!("SPI_GETFONTSMOOTHINGTYPE error: {:X}", GetLastError());
|
||||
tracing::error!("SPI_GETFONTSMOOTHINGTYPE error: {:X}", GetLastError());
|
||||
return TextAntiAliasing::Mono;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ pub fn animation_enabled() -> bool {
|
|||
let mut enabled = true;
|
||||
|
||||
if SystemParametersInfoW(SPI_GETCLIENTAREAANIMATION, 0, &mut enabled as *mut _ as *mut _, 0) == 0 {
|
||||
log::error!("SPI_GETCLIENTAREAANIMATION error: {:X}", GetLastError());
|
||||
tracing::error!("SPI_GETCLIENTAREAANIMATION error: {:X}", GetLastError());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ pub fn key_repeat_delay() -> Duration {
|
|||
let mut index = 0;
|
||||
|
||||
if SystemParametersInfoW(SPI_GETCLIENTAREAANIMATION, 0, &mut index as *mut _ as *mut _, 0) == 0 {
|
||||
log::error!("SPI_GETCLIENTAREAANIMATION error: {:X}", GetLastError());
|
||||
tracing::error!("SPI_GETCLIENTAREAANIMATION error: {:X}", GetLastError());
|
||||
return Duration::from_millis(600);
|
||||
}
|
||||
|
||||
|
|
|
@ -736,7 +736,7 @@ impl<S: AppEventSender> App<S> {
|
|||
fn with_window<R>(&mut self, id: WindowId, action: impl FnOnce(&mut Window) -> R, not_found: impl FnOnce() -> R) -> R {
|
||||
self.assert_started();
|
||||
self.windows.iter_mut().find(|w| w.id() == id).map(action).unwrap_or_else(|| {
|
||||
log::error!("headed window `{}` not found, will return fallback result", id);
|
||||
tracing::error!("headed window `{}` not found, will return fallback result", id);
|
||||
not_found()
|
||||
})
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ macro_rules! with_window_or_surface {
|
|||
} else if let Some($el) = $self.surfaces.iter_mut().find(|w| w.id() == $id) {
|
||||
$action
|
||||
} else {
|
||||
log::error!("window `{}` not found, will return fallback result", $id);
|
||||
tracing::error!("window `{}` not found, will return fallback result", $id);
|
||||
$fallback
|
||||
}
|
||||
};
|
||||
|
@ -1031,7 +1031,7 @@ impl<S: AppEventSender> Api for App<S> {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
log::error!("headed window `{}` not found, will return fallback result", id);
|
||||
tracing::error!("headed window `{}` not found, will return fallback result", id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ impl Window {
|
|||
if let Some(mode) = self.video_mode() {
|
||||
self.window.set_fullscreen(Some(Fullscreen::Exclusive(mode)));
|
||||
} else {
|
||||
log::error!("failed to determinate exclusive video mode, will use windowed fullscreen");
|
||||
tracing::error!("failed to determinate exclusive video mode, will use windowed fullscreen");
|
||||
self.window.set_fullscreen(Some(Fullscreen::Borderless(None)));
|
||||
}
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ impl Window {
|
|||
if let Some(mode) = self.video_mode() {
|
||||
self.window.set_fullscreen(Some(Fullscreen::Exclusive(mode)));
|
||||
} else {
|
||||
log::error!("failed to determinate exclusive video mode, will use windowed fullscreen");
|
||||
tracing::error!("failed to determinate exclusive video mode, will use windowed fullscreen");
|
||||
self.window.set_fullscreen(Some(Fullscreen::Borderless(None)));
|
||||
}
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ impl Window {
|
|||
winerror::S_OK => {}
|
||||
error => {
|
||||
let mtd_name = if visible { "AddTab" } else { "DeleteTab" };
|
||||
log::error!(
|
||||
tracing::error!(
|
||||
target: "window",
|
||||
"cannot set `taskbar_visible`, `ITaskbarList::{}` failed, error: {:X}",
|
||||
mtd_name,
|
||||
|
@ -582,7 +582,7 @@ impl Window {
|
|||
tb.Release();
|
||||
}
|
||||
error => {
|
||||
log::error!(
|
||||
tracing::error!(
|
||||
target: "window",
|
||||
"cannot set `taskbar_visible`, failed to create instance of `ITaskbarList`, error: {:X}",
|
||||
error
|
||||
|
|
|
@ -170,7 +170,7 @@ pub mod grid {
|
|||
let (mut c_span, mut r_span) = state.get(SpanKey).copied().unwrap_or((1, 1));
|
||||
|
||||
if c >= columns_len || r >= rows_len || c_span == 0 || r_span == 0 {
|
||||
log::debug!(
|
||||
tracing::debug!(
|
||||
"grid child index `({:?})`, span `({:?})` is not placeable in a {}x{} grid and will not be rendered",
|
||||
(c, r),
|
||||
(c_span, r_span),
|
||||
|
@ -182,7 +182,7 @@ pub mod grid {
|
|||
}
|
||||
|
||||
if c + c_span > columns_len {
|
||||
log::debug!(
|
||||
tracing::debug!(
|
||||
"grid child column `{}` and span `{}` overflows the a grid with `{}` columns, span corrected",
|
||||
c,
|
||||
c_span,
|
||||
|
@ -191,7 +191,7 @@ pub mod grid {
|
|||
c_span = columns_len - c;
|
||||
}
|
||||
if r + r_span > rows_len {
|
||||
log::debug!(
|
||||
tracing::debug!(
|
||||
"grid child row `{}` and span `{}` overflows the a grid with `{}` rows, span corrected",
|
||||
c,
|
||||
c_span,
|
||||
|
|
|
@ -689,7 +689,7 @@ pub mod window {
|
|||
use std::io::*;
|
||||
stdout()
|
||||
.write_all(&buffer)
|
||||
.unwrap_or_else(|e| log::error!("error printing frame {}", e));
|
||||
.unwrap_or_else(|e| tracing::error!("error printing frame {}", e));
|
||||
});
|
||||
}),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue