LoggingBuilder

Struct LoggingBuilder 

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

Builder for creating logging messages at runtime

Implementations§

Source§

impl LoggingBuilder

Source

pub fn new(level: LoggingLevel, data: Value) -> Self

Create a new logging builder with the given level and data

Source

pub fn logger(self, logger: impl Into<String>) -> Self

Set the logger name/identifier

Source

pub fn meta(self, meta: HashMap<String, Value>) -> Self

Set meta information

Source

pub fn meta_value(self, key: impl Into<String>, value: Value) -> Self

Add a meta key-value pair

Source

pub fn batch_size(self, size: usize) -> Self

Set batch size for log messages

Source

pub fn build(self) -> LoggingMessageNotification

Build the logging message notification

Source

pub fn build_dynamic(self) -> DynamicLogger

Build a dynamic logger that implements the definition traits

Source

pub fn build_session_aware(self) -> SessionAwareLogger

Create session-aware logger that can send messages directly to a session

Source§

impl LoggingBuilder

Convenience methods for different log levels

Source

pub fn debug(data: Value) -> Self

Create a debug level logging builder

Source

pub fn info(data: Value) -> Self

Create an info level logging builder

Source

pub fn notice(data: Value) -> Self

Create a notice level logging builder

Source

pub fn warning(data: Value) -> Self

Create a warning level logging builder

Source

pub fn error(data: Value) -> Self

Create an error level logging builder

Source

pub fn critical(data: Value) -> Self

Create a critical level logging builder

Source

pub fn alert(data: Value) -> Self

Create an alert level logging builder

Source

pub fn emergency(data: Value) -> Self

Create an emergency level logging builder

Source

pub fn text(level: LoggingLevel, message: impl Into<String>) -> Self

Create a simple text log message

Source

pub fn structured(level: LoggingLevel, fields: HashMap<String, Value>) -> Self

Create a structured log message with fields

Source

pub fn with_context( level: LoggingLevel, message: impl Into<String>, context: HashMap<String, Value>, ) -> Self

Create a log message with message and context

Source

pub fn set_level(level: LoggingLevel) -> SetLevelBuilder

Create a set level request builder

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, 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.