Struct fern::Output [] [src]

pub struct Output(_);

Configuration for a logger output.

Methods

impl Output
[src]

[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"))

[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())

[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())

[src]

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]

[src]

Creates an output logger forwarding all messages to the dispatch.

impl From<SharedDispatch> for Output
[src]

[src]

Creates an output logger forwarding all messages to the dispatch.

impl From<Box<Log>> for Output
[src]

[src]

Creates an output logger forwarding all messages to the custom logger.

impl From<&'static Log> for Output
[src]

[src]

Creates an output logger forwarding all messages to the custom logger.

impl From<File> for Output
[src]

[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]

[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]

[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]

[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'.

impl Debug for Output
[src]

[src]

Formats the value using the given formatter.