about
11/12/2022
Rust Logger Repository
RustLogger Repository
Simultaneously log messages to console and file
Quick Status
Concept:
Design:
-
new() -> Self Create newLogger which has no attached file and writes to console. -
init(f:File, con:bool) -> Self Create new Logger attached to f and writes to console only if con istrue . -
console(&mut self, con:bool) sets console writing totrue orfalse . -
file(&mut self, f:File) Sets or resets log filef . -
opt(&mut self, f:Option<File> sets or resetsLogger::fl to the option provided. -
open(&mut self, s:&str) -> bool Opens logger, truncating log file if it exists. -
open_append(&mut self, s:&str) -> bool Opens logger, appending to log file if it exists. -
ts_write(&mut self, s:&str) -> &mut Self Writes date_time stamp then string s to the log target(s). -
write(&mut self, s:&str) -> &mut Self Writes string s to the log target(s). -
close(&mut self) Closes logger by settingLogger::fl to the optionNone .
-
open_file(s:&str, mode:OpenMode) -> Option<File> Opens file with OpenMode::Append or OpenMode::Truncate. Returns option that may be used withLogger::opt(f:Option<File>) . -
file_exists(s:&str) -> bool Does this file exist? -
remove_file(s:&str) -> bool Delete file if it exists and has appropriate access. -
file_contains(fl:&str, ts:&str) -> bool Does the file named fl contain the string ts? -
file_contents(fl:&str) Display text file contents on console.