1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 23:00:04 -04:00

Replace tracing with log (#2928)

* Replace tracing crate with log

It's just so much simpler to use

* Add `bacon wasm` job

* eframe: add a WebLogger for piping log events to the web console
This commit is contained in:
Emil Ernerfeldt
2023-04-18 21:11:26 +02:00
committed by GitHub
parent 0f9e1a3526
commit 9c9a54ce36
48 changed files with 477 additions and 291 deletions

View File

@@ -48,15 +48,15 @@ wayland = ["winit/wayland"]
# - It's also important that we don't impose an android-activity backend by taking this choice away from applications.
## Enable the `native-activity` backend via Winit on Android
android-native-activity = [ "winit/android-native-activity" ]
android-native-activity = ["winit/android-native-activity"]
## Enable the `game-activity` backend via Winit on Android
android-game-activity = [ "winit/android-game-activity" ]
android-game-activity = ["winit/android-game-activity"]
[dependencies]
egui = { version = "0.21.0", path = "../egui", default-features = false, features = [
"tracing",
"log",
] }
tracing = { version = "0.1", default-features = false, features = ["std"] }
log = { version = "0.4", features = ["std"] }
winit = { version = "0.28", default-features = false }
#! ### Optional dependencies
@@ -85,4 +85,3 @@ smithay-clipboard = { version = "0.6.3", optional = true }
[target.'cfg(not(target_os = "android"))'.dependencies]
arboard = { version = "3.2", optional = true, default-features = false }

View File

@@ -66,7 +66,7 @@ impl Clipboard {
return match clipboard.load() {
Ok(text) => Some(text),
Err(err) => {
tracing::error!("smithay paste error: {err}");
log::error!("smithay paste error: {err}");
None
}
};
@@ -77,7 +77,7 @@ impl Clipboard {
return match clipboard.get_text() {
Ok(text) => Some(text),
Err(err) => {
tracing::error!("arboard paste error: {err}");
log::error!("arboard paste error: {err}");
None
}
};
@@ -105,7 +105,7 @@ impl Clipboard {
#[cfg(all(feature = "arboard", not(target_os = "android")))]
if let Some(clipboard) = &mut self.arboard {
if let Err(err) = clipboard.set_text(text) {
tracing::error!("arboard copy/cut error: {err}");
log::error!("arboard copy/cut error: {err}");
}
return;
}
@@ -116,11 +116,11 @@ impl Clipboard {
#[cfg(all(feature = "arboard", not(target_os = "android")))]
fn init_arboard() -> Option<arboard::Clipboard> {
tracing::debug!("Initializing arboard clipboard…");
log::debug!("Initializing arboard clipboard…");
match arboard::Clipboard::new() {
Ok(clipboard) => Some(clipboard),
Err(err) => {
tracing::warn!("Failed to initialize arboard clipboard: {err}");
log::warn!("Failed to initialize arboard clipboard: {err}");
None
}
}
@@ -144,18 +144,18 @@ fn init_smithay_clipboard<T>(
{
use winit::platform::wayland::EventLoopWindowTargetExtWayland as _;
if let Some(display) = _event_loop.wayland_display() {
tracing::debug!("Initializing smithay clipboard…");
log::debug!("Initializing smithay clipboard…");
#[allow(unsafe_code)]
Some(unsafe { smithay_clipboard::Clipboard::new(display) })
} else {
tracing::debug!("Cannot initialize smithay clipboard without a display handle");
log::debug!("Cannot initialize smithay clipboard without a display handle");
None
}
}
#[cfg(not(feature = "wayland"))]
{
tracing::debug!(
log::debug!(
"You need to enable the 'wayland' feature of 'egui-winit' to get a working clipboard"
);
None

View File

@@ -700,12 +700,12 @@ impl State {
fn open_url_in_browser(_url: &str) {
#[cfg(feature = "webbrowser")]
if let Err(err) = webbrowser::open(_url) {
tracing::warn!("Failed to open url: {}", err);
log::warn!("Failed to open url: {}", err);
}
#[cfg(not(feature = "webbrowser"))]
{
tracing::warn!("Cannot open url - feature \"links\" not enabled.");
log::warn!("Cannot open url - feature \"links\" not enabled.");
}
}