use crate::LogLevel;
use crate::log::gen_uuid7;
use crate::log::interface::{Indexed, Loggable};
use serde::Serialize;
#[derive(Serialize, Clone)]
pub(super) struct LockLogEntry {
message: String,
level: LogLevel,
id: uuid7::Uuid,
}
impl LockLogEntry {
pub(super) fn error(msg: impl Into<String>) -> Self {
Self {
message: msg.into(),
level: LogLevel::ERROR,
id: gen_uuid7(),
}
}
pub(super) fn info(msg: impl Into<String>) -> Self {
Self {
message: msg.into(),
level: LogLevel::INFO,
id: gen_uuid7(),
}
}
pub(super) fn warn(msg: impl Into<String>) -> Self {
Self {
message: msg.into(),
level: LogLevel::WARN,
id: gen_uuid7(),
}
}
}
impl Loggable for LockLogEntry {
fn get_log_level(&self) -> Option<crate::LogLevel> {
Some(self.level)
}
fn get_log_kind(&self) -> Option<crate::log::LogType> {
None
}
}
impl Indexed for LockLogEntry {
fn get_id(&self) -> uuid7::Uuid {
self.id
}
fn get_additional_ids(&self) -> Vec<uuid7::Uuid> {
Vec::new()
}
fn get_tags(&self) -> Vec<&str> {
Vec::new()
}
}