use std::{borrow::Cow, sync::Arc};
use crate::{
logs::{LogRecord, Logger, LoggerProvider},
InstrumentationLibrary, KeyValue,
};
#[derive(Clone, Debug, Default)]
pub struct NoopLoggerProvider(());
impl NoopLoggerProvider {
pub fn new() -> Self {
NoopLoggerProvider(())
}
}
impl LoggerProvider for NoopLoggerProvider {
type Logger = NoopLogger;
fn library_logger(&self, _library: Arc<InstrumentationLibrary>) -> Self::Logger {
NoopLogger(())
}
fn versioned_logger(
&self,
_name: impl Into<Cow<'static, str>>,
_version: Option<Cow<'static, str>>,
_schema_url: Option<Cow<'static, str>>,
_attributes: Option<Vec<KeyValue>>,
) -> Self::Logger {
NoopLogger(())
}
}
#[derive(Clone, Debug)]
pub struct NoopLogger(());
impl Logger for NoopLogger {
fn emit(&self, _record: LogRecord) {}
#[cfg(feature = "logs_level_enabled")]
fn event_enabled(&self, _level: super::Severity, _target: &str) -> bool {
true
}
}