This commit is contained in:
sxyazi 2025-01-09 15:55:04 +08:00
parent e33fd1c780
commit 2af101dd40
No known key found for this signature in database
3 changed files with 8 additions and 3 deletions

View file

@ -6,7 +6,7 @@ use ratatui::layout::Rect;
use tokio::{io::AsyncWriteExt, process::{Child, Command}, sync::mpsc::{self, UnboundedSender}};
use tracing::{debug, warn};
use yazi_config::PREVIEW;
use yazi_shared::{LOG_LEVEL, LogLevel, RoCell, env_exists};
use yazi_shared::{LOG_LEVEL, RoCell, env_exists};
use crate::{Adapter, Dimension};
@ -87,7 +87,7 @@ impl Ueberzug {
fn create_demon(adapter: Adapter) -> Result<Child> {
let result = Command::new("ueberzugpp")
.args(["layer", "-so", &adapter.to_string()])
.env("SPDLOG_LEVEL", if LOG_LEVEL.get() != LogLevel::None { "debug" } else { "" })
.env("SPDLOG_LEVEL", if LOG_LEVEL.get().is_none() { "" } else { "debug" })
.kill_on_drop(true)
.stdin(Stdio::piped())
.stdout(Stdio::null())

View file

@ -13,7 +13,7 @@ pub(super) struct Logs;
impl Logs {
pub(super) fn start() -> anyhow::Result<()> {
let level = LOG_LEVEL.get();
if LOG_LEVEL.get() == LogLevel::None {
if LOG_LEVEL.get().is_none() {
return Ok(());
}

View file

@ -32,6 +32,11 @@ pub enum LogLevel {
Debug,
}
impl LogLevel {
#[inline]
pub fn is_none(self) -> bool { self == Self::None }
}
impl From<String> for LogLevel {
fn from(mut s: String) -> Self {
s.make_ascii_uppercase();