logging: remove unused log functions, change log file const to new file (#779)
This commit is contained in:
parent
25d9ce8b9c
commit
76a96b538b
4 changed files with 7 additions and 48 deletions
|
|
@ -15,7 +15,7 @@ pub const MAX_TITLE_STACK_SIZE: usize = 1000;
|
||||||
|
|
||||||
use vte::{Params, Perform};
|
use vte::{Params, Perform};
|
||||||
use zellij_tile::data::{Palette, PaletteColor};
|
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::alacritty_functions::{parse_number, xparse_color};
|
||||||
use crate::panes::terminal_character::{
|
use crate::panes::terminal_character::{
|
||||||
|
|
@ -1943,10 +1943,7 @@ impl Perform for Grid {
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
drop(debug_log_to_file(format!(
|
log::warn!("Unhandled csi: {}->{:?}", c, params);
|
||||||
"Unhandled csi: {}->{:?}",
|
|
||||||
c, params
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use std::fmt::{self, Debug, Display, Formatter};
|
use std::fmt::{self, Debug, Display, Formatter};
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
|
|
||||||
use zellij_utils::logging::debug_log_to_file;
|
|
||||||
use zellij_utils::vte::ParamsIter;
|
use zellij_utils::vte::ParamsIter;
|
||||||
|
|
||||||
use crate::panes::alacritty_functions::parse_sgr_color;
|
use crate::panes::alacritty_functions::parse_sgr_color;
|
||||||
|
|
@ -464,7 +463,7 @@ impl CharacterStyles {
|
||||||
*self = self.background(Some(AnsiCode::NamedColor(NamedColor::BrightWhite)))
|
*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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ lazy_static! {
|
||||||
pub static ref ZELLIJ_TMP_DIR: PathBuf =
|
pub static ref ZELLIJ_TMP_DIR: PathBuf =
|
||||||
PathBuf::from("/tmp/zellij-".to_string() + &format!("{}", *UID));
|
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_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] = &[
|
pub const FEATURES: &[&str] = &[
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use crate::shared::set_permissions;
|
||||||
pub fn configure_logger() {
|
pub fn configure_logger() {
|
||||||
atomic_create_dir(&*ZELLIJ_TMP_DIR).unwrap();
|
atomic_create_dir(&*ZELLIJ_TMP_DIR).unwrap();
|
||||||
atomic_create_dir(&*ZELLIJ_TMP_LOG_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
|
// {n} means platform dependent newline
|
||||||
// module is padded to exactly 25 bytes and thread is padded to be between 10 and 15 bytes.
|
// 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()
|
let log_file = FileAppender::builder()
|
||||||
.encoder(Box::new(PatternEncoder::new(file_pattern)))
|
.encoder(Box::new(PatternEncoder::new(file_pattern)))
|
||||||
.append(true)
|
.append(true)
|
||||||
.build(ZELLIJ_TMP_LOG_DIR.join("zellij.log"))
|
.build(&*ZELLIJ_TMP_LOG_FILE)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// plugin appender. To be used in loggin_pipe to forward stderr output from plugins. We do some formatting
|
// 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}",
|
"{highlight({level:<6})} {message} {n}",
|
||||||
)))
|
)))
|
||||||
.append(true)
|
.append(true)
|
||||||
.build(ZELLIJ_TMP_LOG_DIR.join("zellij.log"))
|
.build(&*ZELLIJ_TMP_LOG_FILE)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Set the default logging level to "info" and log it to zellij.log file
|
// 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
|
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<()> {
|
pub fn debug_to_file(message: &[u8], pid: RawFd) -> io::Result<()> {
|
||||||
let mut path = PathBuf::new();
|
let mut path = PathBuf::new();
|
||||||
path.push(&*ZELLIJ_TMP_LOG_DIR);
|
path.push(&*ZELLIJ_TMP_LOG_DIR);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue