1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::r#struct::betterstack_log_schema::BetterStackLogSchema;
use crate::r#struct::env_config::EnvConfig;
use crate::r#struct::log_level::LogLevel;

#[derive(Debug)]
pub struct LogSchema {
    pub message: String,
    pub context: String,
}

impl LogSchema {
    pub fn to_betterstack(&self, env_config: &EnvConfig, level: LogLevel) -> BetterStackLogSchema {
        BetterStackLogSchema::new(
            env_config,
            level,
            self.message.clone(),
            self.context.clone(),
        )
    }
}