actually make filter work

This commit is contained in:
Intege-rs
2025-09-12 05:31:00 -04:00
parent 3e3ab977c9
commit 03860ba2c7

View File

@@ -1,7 +1,7 @@
use std::io::{stdout, Write}; use std::io::{stdout, Write};
use itertools::{Itertools, Position}; use itertools::{Itertools, Position};
use log::*; use log::*;
use log::__private_api::enabled;
//╶───╴Initializers╶─────────────────────────────────────────────────────────╴ //╶───╴Initializers╶─────────────────────────────────────────────────────────╴
pub fn init() -> Result<(), SetLoggerError>{ pub fn init() -> Result<(), SetLoggerError>{
@@ -31,7 +31,11 @@ pub struct PicoLogger<F: Fn(&Metadata) -> bool + Send + Sync> {
impl<F: Fn(&Metadata) -> bool + Send + Sync> Log for PicoLogger<F> { impl<F: Fn(&Metadata) -> bool + Send + Sync> Log for PicoLogger<F> {
fn enabled(&self, metadata: &Metadata) -> bool { (self.filter)(metadata) } fn enabled(&self, metadata: &Metadata) -> bool { (self.filter)(metadata) }
fn log(&self, record: &Record) { _=format(record); } fn log(&self, record: &Record) {
if self.enabled(record.metadata()) {
_ = format(record);
}
}
fn flush(&self) {} fn flush(&self) {}
} }