From b09ed0af0184d893d94120c6dc076f9e0002435c Mon Sep 17 00:00:00 2001 From: ifengqi <362254883@qq.com> Date: Thu, 12 Sep 2024 22:07:34 +0800 Subject: [PATCH] optimize some logs (#3497) --- lapce-app/src/app.rs | 6 ++++-- lapce-core/src/language.rs | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lapce-app/src/app.rs b/lapce-app/src/app.rs index 30d75c10..1b028b54 100644 --- a/lapce-app/src/app.rs +++ b/lapce-app/src/app.rs @@ -4034,8 +4034,10 @@ pub fn try_open_in_existing_process( fn listen_local_socket(tx: Sender) -> Result<()> { let local_socket = Directory::local_socket() .ok_or_else(|| anyhow!("can't get local socket folder"))?; - if let Err(err) = std::fs::remove_file(&local_socket) { - tracing::error!("{:?}", err); + if local_socket.exists() { + if let Err(err) = std::fs::remove_file(&local_socket) { + tracing::error!("{:?}", err); + } } let socket = interprocess::local_socket::LocalSocketListener::bind(local_socket)?; diff --git a/lapce-core/src/language.rs b/lapce-core/src/language.rs index c2979253..9d0c95d2 100644 --- a/lapce-core/src/language.rs +++ b/lapce-core/src/language.rs @@ -1771,7 +1771,9 @@ fn get_grammar(&self) -> Option { return Some(grammar); } Err(err) => { - tracing::error!("{:?}", err); + if self != &LapceLanguage::PlainText { + tracing::error!("{:?} {:?}", self, err); + } } } };