Shunsuke Shibayama 2024-05-05 14:52:08 +09:00
parent 1f5209a41b
commit 12fa839120
2 changed files with 27 additions and 11 deletions

View file

@ -763,13 +763,14 @@ impl Output {
/// Log to `$ERG_PATH/els.log`
pub fn lsp_log(file: &str, line: u32, msg: &str) {
let file_path = erg_path().join("els.log");
let mut f = if file_path.exists() {
File::options().append(true).open(file_path).unwrap()
let Ok(mut f) = (if file_path.exists() {
File::options().append(true).open(file_path)
} else {
File::create(file_path).unwrap()
File::create(file_path)
}) else {
return;
};
f.write_all(format!("{file}@{line}: {msg}\n").as_bytes())
.unwrap();
let _ = f.write_all(format!("{file}@{line}: {msg}\n").as_bytes());
}
#[macro_export]