actually make filter work
This commit is contained in:
@@ -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) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user