Use env_logger when running the app in a terminal

This commit is contained in:
Max Brunsfeld 2022-03-22 11:44:54 -07:00
parent c105802b2d
commit 0a3f013e00
2 changed files with 3 additions and 4 deletions

View file

@ -64,6 +64,7 @@ crossbeam-channel = "0.5.0"
ctor = "0.1.20" ctor = "0.1.20"
dirs = "3.0" dirs = "3.0"
easy-parallel = "3.1.0" easy-parallel = "3.1.0"
env_logger = "0.8"
futures = "0.3" futures = "0.3"
http-auth-basic = "0.1.3" http-auth-basic = "0.1.3"
ignore = "0.4" ignore = "0.4"

View file

@ -9,7 +9,6 @@ use gpui::{App, AssetSource, Task};
use log::LevelFilter; use log::LevelFilter;
use parking_lot::Mutex; use parking_lot::Mutex;
use project::Fs; use project::Fs;
use simplelog::SimpleLogger;
use smol::process::Command; use smol::process::Command;
use std::{env, fs, path::PathBuf, sync::Arc}; use std::{env, fs, path::PathBuf, sync::Arc};
use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME};
@ -142,11 +141,10 @@ fn main() {
} }
fn init_logger() { fn init_logger() {
let level = LevelFilter::Info;
if stdout_is_a_pty() { if stdout_is_a_pty() {
SimpleLogger::init(level, Default::default()).expect("could not initialize logger"); env_logger::init();
} else { } else {
let level = LevelFilter::Info;
let log_dir_path = dirs::home_dir() let log_dir_path = dirs::home_dir()
.expect("could not locate home directory for logging") .expect("could not locate home directory for logging")
.join("Library/Logs/"); .join("Library/Logs/");