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
[src]
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
[src]
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
[src]
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())
fn sender<T: Into<Cow<'static, str>>>(
sender: Sender<String>,
line_sep: T
) -> Self
[src]
sender: Sender<String>,
line_sep: T
) -> Self
Returns a mpsc::Sender logger using a custom separator.
If the default separator of \n
is acceptable, an mpsc::Sender<String>
instance can be passed into
Dispatch::chain()
directly.
Each log message will be suffixed with the separator, then sent as a single String to the given sender.
use std::sync::mpsc::channel; let (tx, rx) = channel(); fern::Dispatch::new() .chain(tx)
Trait Implementations
impl From<Dispatch> for Output
[src]
fn from(log: Dispatch) -> Self
[src]
Creates an output logger forwarding all messages to the dispatch.
impl From<SharedDispatch> for Output
[src]
fn from(log: SharedDispatch) -> Self
[src]
Creates an output logger forwarding all messages to the dispatch.
impl From<Box<Log>> for Output
[src]
fn from(log: Box<Log>) -> Self
[src]
Creates an output logger forwarding all messages to the custom logger.
impl From<&'static Log> for Output
[src]
fn from(log: &'static Log) -> Self
[src]
Creates an output logger forwarding all messages to the custom logger.
impl From<File> for Output
[src]
fn from(file: File) -> Self
[src]
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
[src]
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
[src]
Creates an output logger which writes all messages to stderr with the given handle and \n
as the separator.
impl From<Sender<String>> for Output
[src]
fn from(stream: Sender<String>) -> Self
[src]
Creates an output logger which writes all messages to the given mpsc::Sender with '\n' as the separator.
All messages sent to the mpsc channel are suffixed with '\n'.