1use crate::LoggerConfig;
4use helia_interface::ComponentLogger;
5
6pub struct TracingLogger {
8 _config: LoggerConfig,
9}
10
11impl TracingLogger {
12 pub fn new(config: LoggerConfig) -> Self {
13 let _ = tracing_subscriber::fmt()
15 .with_max_level(config.level)
16 .with_ansi(true)
17 .try_init();
18
19 Self { _config: config }
20 }
21}
22
23impl ComponentLogger for TracingLogger {
24 fn debug(&self, message: &str) {
25 tracing::debug!("{}", message);
26 }
27
28 fn info(&self, message: &str) {
29 tracing::info!("{}", message);
30 }
31
32 fn warn(&self, message: &str) {
33 tracing::warn!("{}", message);
34 }
35
36 fn error(&self, message: &str) {
37 tracing::error!("{}", message);
38 }
39}