remove unused logger
This commit is contained in:
parent
e24eeebe24
commit
7b4f389b04
1 changed files with 2 additions and 38 deletions
|
@ -1,44 +1,8 @@
|
||||||
use crate::errors::Error;
|
use crate::errors::Error;
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
use std::path::Path;
|
||||||
/// The logger for gregory itself - NOT for jobs
|
use std::time::Instant;
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Logging for a [`Job`]
|
/// Logging for a [`Job`]
|
||||||
pub(crate) struct JobLogger {
|
pub(crate) struct JobLogger {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue