Files
ElyOffice/crates/ely-platform/tests/logging.rs
T
ZacharyZhang-NY b7fca0146d Ely Office: six offline-first desktop apps in Rust and GPUI
ElyDoc, ElyTable, ElyShow (LibreOfficeKit), ElyPDF (MuPDF), ElyTree (Git),
ElyMark (Milkdown and CodeMirror in CEF). ElyMail and ElyAgent follow.
2026-10-08 21:20:08 -04:00

21 lines
653 B
Rust

use ely_platform::{AppId, logging};
#[test]
fn log_lines_reach_the_app_file_and_a_second_init_fails() {
let dir = tempfile::tempdir().unwrap();
logging::init_in(AppId::Doc, dir.path()).unwrap();
log::info!("hello from the test");
log::logger().flush();
let text = std::fs::read_to_string(dir.path().join("ely.log")).unwrap();
assert!(text.contains("ElyDoc 0.1.0 started"), "{text}");
assert!(text.contains("hello from the test"), "{text}");
let error = logging::init_in(AppId::Mail, dir.path()).unwrap_err();
assert!(
format!("{error:#}").contains("a logger is already set"),
"{error:#}"
);
}