pub struct WriteSinkBuilder<W, ArgW> { /* private fields */ }
Expand description

The builder of WriteSink.

Note

The generics here are designed to check for required fields at compile time, users should not specify them manually and/or depend on them. If the generic concrete types or the number of generic types are changed in the future, it may not be considered as a breaking change.

Examples

  • Building a WriteSink.

    use spdlog::{prelude::*, sink::WriteSink};
    
    let sink: WriteSink<_> = WriteSink::builder()
        .target(target) // required
        // .level_filter(LevelFilter::MoreSevere(Level::Info)) // optional
        .build()?;
  • If any required parameters are missing, a compile-time error will be raised.

    use spdlog::{prelude::*, sink::WriteSink};
    
    let sink: WriteSink<_> = WriteSink::builder()
        // .target(target) // required
        .level_filter(LevelFilter::MoreSevere(Level::Info)) // optional
        .build()?;

Implementations

Specifies the target that implemented Write trait, log messages will be written into the target.

This parameter is required.

Specifies a log level filter.

This parameter is optional, and defaults to LevelFilter::All.

Specifies a formatter.

This parameter is optional, and defaults to FullFormatter.

Specifies an error handler.

This parameter is optional, and defaults no handler, see Sink::set_error_handler for details.

Builds a WriteSink.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.