Skip to main content

JsonMessageBuilder

Struct JsonMessageBuilder 

Source
pub struct JsonMessageBuilder<'a, F = AcceptAll> { /* private fields */ }
Expand description

JSON log message builder.

Implementations§

Source§

impl JsonMessageBuilder<'static>

Source

pub fn new() -> Self

Create a new log message builder.

Source§

impl<'a, F> JsonMessageBuilder<'a, F>

Source

pub fn with_field_filter<'b, T>( self, fallback_field: Key, filter: &'b T, ) -> JsonMessageBuilder<'b, T>

Set the field filter.

Source

pub fn finish(self) -> Result<Bytes>

Finish the message.

Trait Implementations§

Source§

impl Default for JsonMessageBuilder<'static>

Source§

fn default() -> Self

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

impl<'a, F> Serializer for JsonMessageBuilder<'a, F>
where F: KVFilter,

Source§

fn emit_bool(&mut self, key: Key, val: bool) -> Result

Emit bool
Source§

fn emit_unit(&mut self, key: Key) -> Result

Emit ()
Source§

fn emit_char(&mut self, key: Key, val: char) -> Result

Emit char
Source§

fn emit_none(&mut self, key: Key) -> Result

Emit None
Source§

fn emit_u8(&mut self, key: Key, val: u8) -> Result

Emit u8
Source§

fn emit_i8(&mut self, key: Key, val: i8) -> Result

Emit i8
Source§

fn emit_u16(&mut self, key: Key, val: u16) -> Result

Emit u16
Source§

fn emit_i16(&mut self, key: Key, val: i16) -> Result

Emit i16
Source§

fn emit_usize(&mut self, key: Key, val: usize) -> Result

Emit usize
Source§

fn emit_isize(&mut self, key: Key, val: isize) -> Result

Emit isize
Source§

fn emit_u32(&mut self, key: Key, val: u32) -> Result

Emit u32
Source§

fn emit_i32(&mut self, key: Key, val: i32) -> Result

Emit i32
Source§

fn emit_f32(&mut self, key: Key, val: f32) -> Result

Emit f32
Source§

fn emit_u64(&mut self, key: Key, val: u64) -> Result

Emit u64
Source§

fn emit_i64(&mut self, key: Key, val: i64) -> Result

Emit i64
Source§

fn emit_f64(&mut self, key: Key, val: f64) -> Result

Emit f64
Source§

fn emit_str(&mut self, key: Key, val: &str) -> Result

Emit &str
Source§

fn emit_arguments(&mut self, key: Key, val: &Arguments<'_>) -> Result

Emit fmt::Arguments Read more
Source§

fn emit_u128(&mut self, key: &'static str, val: u128) -> Result<(), Error>

Emit u128
Source§

fn emit_i128(&mut self, key: &'static str, val: i128) -> Result<(), Error>

Emit i128
Source§

fn emit_bytes( &mut self, key: &'static str, bytes: &[u8], kind: BytesKind, ) -> Result<(), Error>

Emit bytes Read more
Source§

fn emit_serde( &mut self, key: &'static str, value: &dyn SerdeValue, ) -> Result<(), Error>

Available on crate feature nested-values only.
Emit a value implementing serde::Serialize Read more
Source§

fn emit_error( &mut self, key: &'static str, error: &(dyn Error + 'static), ) -> Result<(), Error>

Available on has_std_error only.
Emit a type implementing std::error::Error Read more

Auto Trait Implementations§

§

impl<'a, F> Freeze for JsonMessageBuilder<'a, F>
where &'a F: Freeze,

§

impl<'a, F> RefUnwindSafe for JsonMessageBuilder<'a, F>

§

impl<'a, F> Send for JsonMessageBuilder<'a, F>
where &'a F: Send,

§

impl<'a, F> Sync for JsonMessageBuilder<'a, F>
where &'a F: Sync,

§

impl<'a, F> Unpin for JsonMessageBuilder<'a, F>
where &'a F: Unpin,

§

impl<'a, F> UnsafeUnpin for JsonMessageBuilder<'a, F>

§

impl<'a, F> UnwindSafe for JsonMessageBuilder<'a, F>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more