use serde::{Deserialize, Serialize};
use crate::level::Level;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Metadata {
name: String,
target: String,
level: Level,
module_path: Option<String>,
file: Option<String>,
line: Option<u32>,
}
impl Metadata {
pub const fn new(
name: String,
target: String,
level: Level,
module_path: Option<String>,
file: Option<String>,
line: Option<u32>,
) -> Self {
Metadata {
name,
target,
level,
module_path,
file,
line,
}
}
pub fn level(&self) -> &Level {
&self.level
}
pub fn name(&self) -> &String {
&self.name
}
pub fn target(&self) -> &String {
&self.target
}
pub fn module_path(&self) -> Option<&String> {
self.module_path.as_ref()
}
pub fn file(&self) -> Option<&String> {
self.file.as_ref()
}
pub fn line(&self) -> Option<u32> {
self.line
}
}