zlog: Use zlog as default log implementation (#28612)

Still TODO:

- [x] Remove old log implementations
- [x] More cleanup
- [x] Verify atomic/lock logic
- [x] More tests
- [ ] ??? Ansi coloring when logging to stdout

Release Notes:

- N/A
This commit is contained in:
Ben Kunkle 2025-04-14 10:17:07 -04:00 committed by GitHub
parent 0eb0a3c7dc
commit 4a57664c7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 872 additions and 706 deletions

View file

@ -1,7 +1,6 @@
// Disable command line from opening on release mode
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
mod logger;
mod reliability;
mod zed;
@ -28,7 +27,6 @@ use prompt_store::PromptBuilder;
use reqwest_client::ReqwestClient;
use assets::Assets;
use logger::{init_logger, init_stdout_logger};
use node_runtime::{NodeBinaryOptions, NodeRuntime};
use parking_lot::Mutex;
use project::project_settings::ProjectSettings;
@ -195,11 +193,15 @@ fn main() {
return;
}
zlog::init_from_env();
zlog::init();
if stdout_is_a_pty() {
init_stdout_logger();
zlog::init_output_stdout();
} else {
init_logger();
let result = zlog::init_output_file(paths::log_file(), Some(paths::old_log_file()));
if let Err(err) = result {
eprintln!("Could not open log file: {}... Defaulting to stdout", err);
zlog::init_output_stdout();
};
}
log::info!("========== starting zed ==========");