Skip to content

Commit

Permalink
Use env_logger instead of simple_logger (#241)
Browse files Browse the repository at this point in the history
* Use env_logger instead of simple_logger

* Make clippy happy
  • Loading branch information
Ngo Iok Ui (Wu Yu Wei) authored Nov 12, 2021
1 parent 1632772 commit 72846fb
Show file tree
Hide file tree
Showing 32 changed files with 33 additions and 62 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ crossbeam-channel = "0.5"

[dev-dependencies]
image = "0.23"
simple_logger = "1.13"
env_logger = "0.9"

[target."cfg(target_os = \"android\")".dependencies]
ndk = "0.4"
Expand Down
3 changes: 1 addition & 2 deletions examples/accelerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

fn main() {
use simple_logger::SimpleLogger;
use tao::{
accelerator::{Accelerator, RawMods},
dpi::LogicalSize,
Expand All @@ -12,7 +11,7 @@ fn main() {
window::WindowBuilder,
};

SimpleLogger::new().init().unwrap();
env_logger::init();

// create a sample hotkey
let hotkey = Accelerator::new(RawMods::Shift, KeyCode::Digit1);
Expand Down
3 changes: 1 addition & 2 deletions examples/control_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use std::{thread, time};

use simple_logger::SimpleLogger;
use tao::{
event::{ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -23,7 +22,7 @@ const POLL_SLEEP_TIME: time::Duration = time::Duration::from_millis(100);

#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();

println!("Press '1' to switch to Wait mode.");
println!("Press '2' to switch to WaitUntil mode.");
Expand Down
3 changes: 1 addition & 2 deletions examples/cursor.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
event::{ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::{CursorIcon, WindowBuilder},
};

fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window = WindowBuilder::new().build(&event_loop).unwrap();
Expand Down
3 changes: 1 addition & 2 deletions examples/cursor_grab.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
event::{DeviceEvent, ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -11,7 +10,7 @@ use tao::{

#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 1 addition & 2 deletions examples/custom_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#[allow(clippy::single_match)]
fn main() {
use simple_logger::SimpleLogger;
env_logger::init();
use tao::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -15,7 +15,6 @@ fn main() {
Timer,
}

SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::<CustomEvent>::with_user_event();

let _window = WindowBuilder::new()
Expand Down
3 changes: 1 addition & 2 deletions examples/custom_menu.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
#[cfg(target_os = "macos")]
use tao::platform::macos::{CustomMenuItemExtMacOS, NativeImage};
use tao::{
Expand All @@ -15,7 +14,7 @@ use tao::{
};

fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

// create clipboard instance
Expand Down
3 changes: 1 addition & 2 deletions examples/drag_window.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
event::{ElementState, Event, KeyEvent, MouseButton, StartCause, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -11,7 +10,7 @@ use tao::{

#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window_1 = WindowBuilder::new().build(&event_loop).unwrap();
Expand Down
3 changes: 1 addition & 2 deletions examples/fullscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use std::io::{stdin, stdout, Write};

use simple_logger::SimpleLogger;
use tao::{
event::{ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -14,7 +13,7 @@ use tao::{
#[allow(clippy::single_match)]
#[allow(clippy::ok_expect)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

print!("Please choose the fullscreen mode: (1) exclusive, (2) borderless: ");
Expand Down
3 changes: 1 addition & 2 deletions examples/global_shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
fn main() {
use simple_logger::SimpleLogger;
use std::str::FromStr;
use tao::{
accelerator::{Accelerator, AcceleratorId, RawMods, SysMods},
Expand All @@ -14,7 +13,7 @@ fn main() {
window::WindowBuilder,
};

SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

// create new shortcut manager instance
Expand Down
3 changes: 1 addition & 2 deletions examples/handling_close.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
event::{ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -11,7 +10,7 @@ use tao::{

#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let _window = WindowBuilder::new()
Expand Down
3 changes: 1 addition & 2 deletions examples/min_max_size.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
dpi::LogicalSize,
event::{Event, WindowEvent},
Expand All @@ -11,7 +10,7 @@ use tao::{

#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window = WindowBuilder::new().build(&event_loop).unwrap();
Expand Down
3 changes: 1 addition & 2 deletions examples/minimize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

extern crate tao;

use simple_logger::SimpleLogger;
use tao::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -13,7 +12,7 @@ use tao::{

#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 1 addition & 2 deletions examples/monitor_list.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{event_loop::EventLoop, window::WindowBuilder};

fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();
let window = WindowBuilder::new().build(&event_loop).unwrap();

Expand Down
3 changes: 1 addition & 2 deletions examples/mouse_wheel.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
event::{DeviceEvent, Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -11,7 +10,7 @@ use tao::{
#[allow(clippy::collapsible_match)]
#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 1 addition & 2 deletions examples/multithreaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
fn main() {
use std::{collections::HashMap, sync::mpsc, thread, time::Duration};

use simple_logger::SimpleLogger;
use tao::{
dpi::{PhysicalPosition, PhysicalSize, Position, Size},
event::{ElementState, Event, KeyEvent, WindowEvent},
Expand All @@ -18,7 +17,7 @@ fn main() {
const WINDOW_COUNT: usize = 3;
const WINDOW_SIZE: PhysicalSize<u32> = PhysicalSize::new(600, 400);

SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();
let mut window_senders = HashMap::with_capacity(WINDOW_COUNT);
for _ in 0..WINDOW_COUNT {
Expand Down
3 changes: 1 addition & 2 deletions examples/multiwindow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

use std::collections::HashMap;

use simple_logger::SimpleLogger;
use tao::{
event::{ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::Window,
};

fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let mut windows = HashMap::new();
Expand Down
3 changes: 1 addition & 2 deletions examples/parentwindow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#[cfg(any(target_os = "windows", target_os = "macos"))]
fn main() {
use simple_logger::SimpleLogger;
use std::collections::HashMap;
#[cfg(target_os = "macos")]
use tao::platform::macos::{WindowBuilderExtMacOS, WindowExtMacOS};
Expand All @@ -17,7 +16,7 @@ fn main() {
};
#[cfg(target_os = "windows")]
use windows::Win32::Foundation::HWND;
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();
let mut windows = HashMap::new();
let main_window = WindowBuilder::new().build(&event_loop).unwrap();
Expand Down
3 changes: 1 addition & 2 deletions examples/request_redraw.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
event::{ElementState, Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -10,7 +9,7 @@ use tao::{

#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 1 addition & 2 deletions examples/request_redraw_threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use std::{thread, time};

use simple_logger::SimpleLogger;
use tao::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
Expand All @@ -13,7 +12,7 @@ use tao::{
#[allow(clippy::single_match)]
#[allow(clippy::collapsible_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window = WindowBuilder::new()
Expand Down
3 changes: 1 addition & 2 deletions examples/resizable.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
dpi::LogicalSize,
event::{ElementState, Event, KeyEvent, WindowEvent},
Expand All @@ -12,7 +11,7 @@ use tao::{

#[allow(clippy::single_match)]
fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let mut resizable = false;
Expand Down
3 changes: 1 addition & 2 deletions examples/set_ime_position.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

use simple_logger::SimpleLogger;
use tao::{
dpi::PhysicalPosition,
event::{ElementState, Event, WindowEvent},
Expand All @@ -10,7 +9,7 @@ use tao::{
};

fn main() {
SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();

let window = WindowBuilder::new().build(&event_loop).unwrap();
Expand Down
3 changes: 1 addition & 2 deletions examples/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
#[cfg(feature = "tray")]
fn main() {
use simple_logger::SimpleLogger;
use std::collections::HashMap;
#[cfg(target_os = "linux")]
use std::path::Path;
Expand All @@ -20,7 +19,7 @@ fn main() {
window::{Window, WindowId},
};

SimpleLogger::new().init().unwrap();
env_logger::init();
let event_loop = EventLoop::new();
let mut windows: HashMap<WindowId, Window> = HashMap::new();

Expand Down
3 changes: 1 addition & 2 deletions examples/system_tray_no_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
#[cfg(feature = "tray")]
fn main() {
use simple_logger::SimpleLogger;
use std::collections::HashMap;
#[cfg(target_os = "linux")]
use std::path::Path;
Expand All @@ -27,7 +26,7 @@ fn main() {
window::WindowBuilder,
};

SimpleLogger::new().init().unwrap();
env_logger::init();
#[cfg(target_os = "macos")]
let mut event_loop = EventLoop::new();

Expand Down
Loading

0 comments on commit 72846fb

Please sign in to comment.