dirty_logging 0.1.0

A fast (to code), stateless logging utility with no dependancies to output to stout or output.log with ease.
Documentation
use super::log_utils::timestamp;
use std::fs;
use std::io::Write;

trait Filize {
    fn to_file(self);
}

impl Filize for &str {
    fn to_file(self){
        let mut file = fs::OpenOptions::new()
            .create(true)
            .append(true)
            .open("output.log")
            .unwrap();
    
        let _ = writeln!(file, "{}", self);
    }
}

pub fn trace<S: Into<String>>(mesg: S) {
    format!("[{}] [{}] {}", timestamp(), "TRACE", mesg.into())
        .as_str()
        .to_file();
}

pub fn debug<S: Into<String>>(mesg: S) {
    format!("[{}] [{}] {}", timestamp(), "DEBUG", mesg.into())
        .as_str()
        .to_file();
}

pub fn info<S: Into<String>>(mesg: S) {
    format!("[{}] [{}] {}", timestamp(), "INFO", mesg.into())
        .as_str()
        .to_file();
}

pub fn notice<S: Into<String>>(mesg: S) {
    format!("[{}] [{}] {}", timestamp(), "NOTICE", mesg.into())
        .as_str()
        .to_file();
}

pub fn warn<S: Into<String>>(mesg: S) {
    format!("[{}] [{}] {}", timestamp(), "WARN", mesg.into())
        .as_str()
        .to_file();
}

pub fn error<S: Into<String>>(mesg: S) {
    format!("[{}] [{}] {}", timestamp(), "ERROR", mesg.into())
        .as_str()
        .to_file();
}

pub fn critical<S: Into<String>>(mesg: S) {
    format!("[{}] [{}] {}", timestamp(), "CRITICAL", mesg.into())
        .as_str()
        .to_file();
}

pub fn emergency<S: Into<String>>(mesg: S) {
    format!("[{}] [{}] {}", timestamp(), "EMERGENCY", mesg.into())
        .as_str()
        .to_file();
}