refactor(logger): remove commented-out lines in logger implementation

This commit is contained in:
PandaDEV 2025-01-11 00:05:47 +10:00
parent d7fb3af04d
commit 617c1737b7
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C

View file

@ -17,7 +17,6 @@ impl log::Log for FileLogger {
if self.enabled(record.metadata()) { if self.enabled(record.metadata()) {
let mut file = self.file.try_clone().expect("Failed to clone file handle"); let mut file = self.file.try_clone().expect("Failed to clone file handle");
// Format: timestamp [LEVEL] target: message (file:line)
writeln!( writeln!(
file, file,
"{} [{:<5}] {}: {} ({}:{})", "{} [{:<5}] {}: {} ({}:{})",
@ -40,15 +39,13 @@ pub fn init_logger(app_data_dir: &std::path::Path) -> Result<(), SetLoggerError>
let logs_dir = app_data_dir.join("logs"); let logs_dir = app_data_dir.join("logs");
std::fs::create_dir_all(&logs_dir).expect("Failed to create logs directory"); std::fs::create_dir_all(&logs_dir).expect("Failed to create logs directory");
// Use .log extension for standard log files
let log_path = logs_dir.join("app.log"); let log_path = logs_dir.join("app.log");
let file = OpenOptions::new() let file = OpenOptions::new()
.create(true) .create(true)
.append(true) // Use append mode instead of write .append(true)
.open(&log_path) .open(&log_path)
.expect("Failed to open log file"); .expect("Failed to open log file");
// Set up panic hook
let panic_file = file.try_clone().expect("Failed to clone file handle"); let panic_file = file.try_clone().expect("Failed to clone file handle");
panic::set_hook( panic::set_hook(
Box::new(move |panic_info| { Box::new(move |panic_info| {