SinkProp

Struct SinkProp 

Source
pub struct SinkProp { /* private fields */ }
Expand description

Contains definitions of sink properties.

It provides a set of common properties for sink to define. If there is no special need for properties, use it directly and then implement GetSinkProp for your sink, a blanket implementation will be enabled, which would eliminate a lot of boilerplate code.

If further customization of the properties is needed (e.g., using different types, changing behavior), this struct is not needed. Instead, define properties manually within your sink, and then implement SinkPropAccess.

Implementations§

Source§

impl SinkProp

Source

pub fn level_filter(&self) -> LevelFilter

Gets the log level filter.

Source

pub fn set_level_filter(&self, level_filter: LevelFilter)

Sets the log level filter.

Source

pub fn formatter<'a>(&'a self) -> impl Deref<Target = dyn Formatter> + 'a

Gets the formatter.

The returned value is a lock guard, so please avoid storing it in a variable with a longer lifetime.

Source

pub fn set_formatter<F>(&self, formatter: F)
where F: Formatter + 'static,

Sets the formatter.

Source

pub fn set_formatter_boxed(&self, formatter: Box<dyn Formatter>)

Sets the boxed formatter.

Source

pub fn call_error_handler(&self, err: Error)

Calls the error handler with an error.

Source

pub fn set_error_handler<F: Into<ErrorHandler>>(&self, handler: F)

Sets a error handler.

Most errors that occur in Sink will be returned as directly as possible (e.g. returned to Logger), but some errors that cannot be returned immediately, this function will be called. For example, asynchronous errors.

Trait Implementations§

Source§

impl Default for SinkProp

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.