Lexer test mode works

This commit is contained in:
2024-08-04 23:24:32 +02:00
parent 9d35ba8040
commit 11951ede43
36 changed files with 687 additions and 115 deletions

View File

@@ -0,0 +1,16 @@
use std::{fs::File, io::Write};
pub use orchid_api::logging::LogStrategy;
pub struct Logger(LogStrategy);
impl Logger {
pub fn new(strat: LogStrategy) -> Self { Self(strat) }
pub fn log(&self, msg: String) {
match &self.0 {
LogStrategy::StdErr => eprintln!("{msg}"),
LogStrategy::File(f) => writeln!(File::open(f).unwrap(), "{msg}").unwrap(),
}
}
pub fn strat(&self) -> LogStrategy { self.0.clone() }
}