Struct fern::Output
[−]
[src]
pub struct Output(_);
Configuration for a logger output.
Methods
impl Output
[src]
fn file<T: Into<Cow<'static, str>>>(file: File, line_sep: T) -> Self
Returns a file logger using a custom separator.
If the default separator of \n
is acceptable, an fs::File
instance can be passed into
Dispatch::chain
directly.
fern::Dispatch::new() .chain(std::fs::File::create("log")?)
fern::Dispatch::new() .chain(fern::log_file("log")?)
Example usage (using fern::log_file
):
fern::Dispatch::new() .chain(fern::Output::file(fern::log_file("log")?, "\r\n"))
fn stdout<T: Into<Cow<'static, str>>>(line_sep: T) -> Self
Returns an stdout logger using a custom separator.
If the default separator of \n
is acceptable, an io::Stdout
instance can be passed into
Dispatch::chain()
directly.
fern::Dispatch::new() .chain(std::io::stdout())
fn stderr<T: Into<Cow<'static, str>>>(line_sep: T) -> Self
Returns an stderr logger using a custom separator.
If the default separator of \n
is acceptable, an io::Stderr
instance can be passed into
Dispatch::chain()
directly.
fern::Dispatch::new() .chain(std::io::stderr())
Trait Implementations
impl From<Dispatch> for Output
[src]
impl From<SharedDispatch> for Output
[src]
fn from(log: SharedDispatch) -> Self
Creates an output logger forwarding all messages to the dispatch.
impl From<Box<FernLog>> for Output
[src]
fn from(log: Box<FernLog>) -> Self
Creates an output logger forwarding all messages to the custom logger.
impl From<File> for Output
[src]
fn from(file: File) -> Self
Creates an output logger which writes all messages to the file with \n
as the separator.
File writes are buffered and flushed once per log record.
impl From<Stdout> for Output
[src]
fn from(stream: Stdout) -> Self
Creates an output logger which writes all messages to stdout with the given handle and \n
as the separator.
impl From<Stderr> for Output
[src]
fn from(stream: Stderr) -> Self
Creates an output logger which writes all messages to stderr with the given handle and \n
as the separator.