____ _ _______ __
/ __ \ | /| / / __/ |/ /
/ /_/ / |/ |/ / _// /
\____/|__/|__/___/_||_/
snolc / src/logging.rs
use std::collections::BTreeSet;
use std::env;
use std::fs::{self, File, OpenOptions};
use std::io::{Read, Seek, SeekFrom, Write};
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use std::time::{SystemTime, UNIX_EPOCH};
use crate::error::{Error, Result};
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub enum Level {
Warning,
Error,
Debug,
}
impl Level {
const fn as_str(self) -> &'static str {
match self {
Self::Warning => "warning",
Self::Error => "error",
Self::Debug => "debug",
}
}
}
#[derive(Clone, Debug)]
pub struct Logger {
inner: Arc,
}
#[derive(Debug)]
struct Inner {
levels: BTreeSet,
output: Option