diff --git a/src/logging.rs b/src/logging.rs index 9865b23..fbf57b7 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -1,44 +1,8 @@ use crate::errors::Error; use std::fs::{File, OpenOptions}; use std::io::Write; - -/// The logger for gregory itself - NOT for jobs -pub(crate) struct Logger { - log_file: File, -} - -impl Logger { - pub(crate) fn new(path: String) -> Result<Logger, Error> { - match OpenOptions::new().append(true).open(path) { - Ok(f) => return Ok(Logger { log_file: f }), - Err(e) => { - return Err(Error::IOError(e)); - } - } - } - - /// Log a warning - /// - /// Fun gregory lore: I originally typo'd this as "Strign" and the linter didn't catch it for some reason - pub(crate) fn warning(&mut self, text: String) -> Result<(), Error> { - match writeln!(&mut self.log_file, "[WARNING] {}", text) { - Ok(_) => return Ok(()), - Err(e) => { - return Err(Error::IOError(e)); - } - } - } - - /// Log an error - pub(crate) fn error(&mut self, text: String) -> Result<(), Error> { - match writeln!(&mut self.log_file, "[ERROR] {}", text) { - Ok(_) => return Ok(()), - Err(e) => { - return Err(Error::IOError(e)); - } - } - } -} +use std::path::Path; +use std::time::Instant; /// Logging for a [`Job`] pub(crate) struct JobLogger {