@ -1,7 +1,12 @@
use std ::sync ::mpsc ;
use std ::sync ::mpsc ;
#[ cfg(feature = " ansi " ) ]
mod ansi ;
mod ansi ;
#[ cfg(feature = " ansi " ) ]
use ansi ::ANSIFrontend ;
mod barebones ;
mod barebones ;
use barebones ::BarebonesFrontend ;
use fern ::Dispatch ;
use fern ::Dispatch ;
@ -11,7 +16,6 @@ use crate::{
server_properties ::ServerProperties ,
server_properties ::ServerProperties ,
} ;
} ;
use self ::{ ansi ::ANSIFrontend , barebones ::BarebonesFrontend } ;
pub type Stdout = mpsc ::Sender < String > ;
pub type Stdout = mpsc ::Sender < String > ;
pub type Stdin < T > = mpsc ::Receiver < T > ;
pub type Stdin < T > = mpsc ::Receiver < T > ;
@ -63,9 +67,10 @@ pub fn setup(properties: &ServerProperties) -> anyhow::Result<(Close, Stdin<Stri
// TODO select logging frontend
// TODO select logging frontend
match properties . logger . as_str ( ) {
match properties . logger . as_str ( ) {
"barebones" = > BarebonesFrontend ::setup ( properties , d ) ,
"barebones" = > BarebonesFrontend ::setup ( properties , d ) ,
#[ cfg(feature = " ansi " ) ]
"ANSI" = > ANSIFrontend ::setup ( properties , d ) ,
"ANSI" = > ANSIFrontend ::setup ( properties , d ) ,
x = > {
x = > {
println ! ( "Unrecognized logging frontend {}, please select a valid one (barebones, ANSI) from the ones featured on your build, whose list could be smaller than the one shown" , x ) ;
println ! ( "Unrecognized logging frontend {}, please select a valid one (barebones, ANSI) from the ones featured on your build, that could have less options than the ones shown" , x ) ;
Err ( anyhow ::anyhow ! ( "Unrecognized logging frontend" ) )
Err ( anyhow ::anyhow ! ( "Unrecognized logging frontend" ) )
}
}
}
}