use crate::log::log_level::LogLevel;
pub static CODE_STR: &str = "code";
pub static RET_STR: &str = "ret";
pub static DESC: &str = "desc";
pub type LogListener = Box<dyn Fn(VibeLogInfo) + Send + Sync + 'static>;
#[derive(Debug, Clone)]
pub struct VibeLogInfo {
pub level: LogLevel,
pub tag: String,
pub content: String,
pub create_time: i64,
}
#[allow(dead_code)]
pub fn long_text(method_name: &str, tag: &str, content: &str) {
let content_short = {
let mut iter = content.chars();
let head: String = iter.by_ref().take(20).collect();
if iter.next().is_some() {
let total_mb = content.len() as f64 / (1024.0 * 1024.0);
format!("{head}...[{total_mb:.2} MB]")
} else {
head
}
};
crate::log_s!(method_name, tag, content_short.as_str());
}
#[cfg(test)]
mod strict_tests {
use super::*;
include!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/test/unit/log/log_def_tests.rs"
));
}