Skip to content

Commit

Permalink
revert env_logger downgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Aug 27, 2024
1 parent ac5f593 commit 63fb0d2
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 68 deletions.
77 changes: 34 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions crates/tauri-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ os_pipe = "1"
ignore = "0.4"
ctrlc = "3.4"
log = { version = "0.4.21", features = ["kv", "kv_std"] }
env_logger = "0.8.4"
env_logger = { version = "0.11.5", default-features = false, features = [
"auto-color",
"humantime",
"regex",
] }
icns = { package = "tauri-icns", version = "0.1" }
image = { version = "0.25", default-features = false, features = ["ico"] }
axum = { version = "0.7.4", features = ["ws"] }
Expand Down Expand Up @@ -118,11 +122,7 @@ pretty_assertions = "1"

[target."cfg(windows)".dependencies.windows-sys]
version = "0.59"
features = [
"Win32_Storage_FileSystem",
"Win32_System_IO",
"Win32_System_Console",
]
features = ["Win32_Storage_FileSystem", "Win32_System_IO", "Win32_System_Console"]

[target."cfg(unix)".dependencies]
libc = "0.2"
Expand All @@ -133,10 +133,6 @@ tauri-macos-sign = { version = "0.1.1-rc.0", path = "../tauri-macos-sign" }

[features]
default = ["rustls"]
native-tls = [
"tauri-bundler/native-tls",
"cargo-mobile2/native-tls",
"ureq/native-tls",
]
native-tls = ["tauri-bundler/native-tls", "cargo-mobile2/native-tls", "ureq/native-tls"]
native-tls-vendored = ["native-tls", "tauri-bundler/native-tls-vendored"]
rustls = ["tauri-bundler/rustls", "cargo-mobile2/rustls", "ureq/tls"]
27 changes: 13 additions & 14 deletions crates/tauri-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ mod plugin;
mod signer;

use clap::{ArgAction, CommandFactory, FromArgMatches, Parser, Subcommand, ValueEnum};
use env_logger::fmt::Color;
use env_logger::fmt::style::{AnsiColor, Style};
use env_logger::Builder;
use log::Level;
use serde::{Deserialize, Serialize};
use std::io::{BufReader, Write};
Expand Down Expand Up @@ -213,35 +214,33 @@ where
Err(e) => e.exit(),
};

let mut builder = env_logger::Builder::from_default_env();
let mut builder = Builder::from_default_env();
let init_res = builder
.format_indent(Some(12))
.filter(None, verbosity_level(cli.verbose).to_level_filter())
.format(|f, record| {
let mut style = f.style();

let mut is_command_output = false;
if let Some(action) = record.key_values().get("action".into()) {
let action = action.to_cow_str().unwrap();
is_command_output = action == "stdout" || action == "stderr";
if !is_command_output {
let style = style.set_color(Color::Green).set_bold(true);
let value = style.value(action);
let style = Style::new().fg_color(Some(AnsiColor::Green.into())).bold();

write!(f, " {value} ")?;
write!(f, " {style}{}{style:#} ", action)?;
}
} else {
let mut style = f.default_level_style(record.level());
style.set_bold(true);
let value = style.value(prettyprint_level(record.level()));
write!(f, " {value} ",)?;
let style = f.default_level_style(record.level()).bold();
write!(
f,
" {style}{}{style:#} ",
prettyprint_level(record.level())
)?;
}

if !is_command_output && log::log_enabled!(Level::Debug) {
let style = style.set_color(Color::Black);
let value = style.value(record.target());
let style = Style::new().fg_color(Some(AnsiColor::Black.into()));

write!(f, "[{value}] ")?;
write!(f, "[{style}{}{style:#}] ", record.target())?;
}

writeln!(f, "{}", record.args())
Expand Down

0 comments on commit 63fb0d2

Please sign in to comment.