diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index 58459327..4e9ef158 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -15,7 +15,7 @@ pub const MAX_TITLE_STACK_SIZE: usize = 1000; use vte::{Params, Perform}; use zellij_tile::data::{Palette, PaletteColor}; -use zellij_utils::{consts::VERSION, logging::debug_log_to_file, shared::version_number}; +use zellij_utils::{consts::VERSION, shared::version_number}; use crate::panes::alacritty_functions::{parse_number, xparse_color}; use crate::panes::terminal_character::{ @@ -1943,10 +1943,7 @@ impl Perform for Grid { _ => {} } } else { - drop(debug_log_to_file(format!( - "Unhandled csi: {}->{:?}", - c, params - ))); + log::warn!("Unhandled csi: {}->{:?}", c, params); } } diff --git a/zellij-server/src/panes/terminal_character.rs b/zellij-server/src/panes/terminal_character.rs index 543d23e1..ce5d8906 100644 --- a/zellij-server/src/panes/terminal_character.rs +++ b/zellij-server/src/panes/terminal_character.rs @@ -1,7 +1,6 @@ use std::fmt::{self, Debug, Display, Formatter}; use std::ops::{Index, IndexMut}; -use zellij_utils::logging::debug_log_to_file; use zellij_utils::vte::ParamsIter; use crate::panes::alacritty_functions::parse_sgr_color; @@ -464,7 +463,7 @@ impl CharacterStyles { *self = self.background(Some(AnsiCode::NamedColor(NamedColor::BrightWhite))) } _ => { - let _ = debug_log_to_file(format!("unhandled csi m code {:?}", param)); + log::warn!("unhandled csi m code {:?}", param); return; } } diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index 4e6ad9d0..bcb4ea4a 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -51,7 +51,7 @@ lazy_static! { pub static ref ZELLIJ_TMP_DIR: PathBuf = PathBuf::from("/tmp/zellij-".to_string() + &format!("{}", *UID)); pub static ref ZELLIJ_TMP_LOG_DIR: PathBuf = ZELLIJ_TMP_DIR.join("zellij-log"); - pub static ref ZELLIJ_TMP_LOG_FILE: PathBuf = ZELLIJ_TMP_LOG_DIR.join("log.txt"); + pub static ref ZELLIJ_TMP_LOG_FILE: PathBuf = ZELLIJ_TMP_LOG_DIR.join("zellij.log"); } pub const FEATURES: &[&str] = &[ diff --git a/zellij-utils/src/logging.rs b/zellij-utils/src/logging.rs index 6d2fe8c6..74ec5397 100644 --- a/zellij-utils/src/logging.rs +++ b/zellij-utils/src/logging.rs @@ -19,7 +19,7 @@ use crate::shared::set_permissions; pub fn configure_logger() { atomic_create_dir(&*ZELLIJ_TMP_DIR).unwrap(); atomic_create_dir(&*ZELLIJ_TMP_LOG_DIR).unwrap(); - atomic_create_file(&*ZELLIJ_TMP_LOG_DIR.join("zellij.log")).unwrap(); + atomic_create_file(&*ZELLIJ_TMP_LOG_FILE).unwrap(); // {n} means platform dependent newline // module is padded to exactly 25 bytes and thread is padded to be between 10 and 15 bytes. @@ -29,7 +29,7 @@ pub fn configure_logger() { let log_file = FileAppender::builder() .encoder(Box::new(PatternEncoder::new(file_pattern))) .append(true) - .build(ZELLIJ_TMP_LOG_DIR.join("zellij.log")) + .build(&*ZELLIJ_TMP_LOG_FILE) .unwrap(); // plugin appender. To be used in loggin_pipe to forward stderr output from plugins. We do some formatting @@ -39,7 +39,7 @@ pub fn configure_logger() { "{highlight({level:<6})} {message} {n}", ))) .append(true) - .build(ZELLIJ_TMP_LOG_DIR.join("zellij.log")) + .build(&*ZELLIJ_TMP_LOG_FILE) .unwrap(); // Set the default logging level to "info" and log it to zellij.log file @@ -89,43 +89,6 @@ pub fn atomic_create_dir(dir_name: &Path) -> io::Result<()> { result } -pub fn debug_log_to_file(mut message: String) -> io::Result<()> { - message.push('\n'); - debug_log_to_file_without_newline(message) -} - -pub fn debug_log_to_file_without_newline(message: String) -> io::Result<()> { - atomic_create_file(&*ZELLIJ_TMP_LOG_FILE)?; - let mut file = fs::OpenOptions::new() - .append(true) - .open(&*ZELLIJ_TMP_LOG_FILE)?; - file.write_all(message.as_bytes()) -} - -pub fn _debug_log_to_file_pid_3(message: String, pid: RawFd) -> io::Result<()> { - if pid == 3 { - debug_log_to_file(message) - } else { - Ok(()) - } -} - -pub fn _delete_log_file() -> io::Result<()> { - if fs::metadata(&*ZELLIJ_TMP_LOG_FILE).is_ok() { - fs::remove_file(&*ZELLIJ_TMP_LOG_FILE) - } else { - Ok(()) - } -} - -pub fn _delete_log_dir() -> io::Result<()> { - if fs::metadata(&*ZELLIJ_TMP_LOG_DIR).is_ok() { - fs::remove_dir_all(&*ZELLIJ_TMP_LOG_DIR) - } else { - Ok(()) - } -} - pub fn debug_to_file(message: &[u8], pid: RawFd) -> io::Result<()> { let mut path = PathBuf::new(); path.push(&*ZELLIJ_TMP_LOG_DIR);