Struct libstrophe::Logger

source ·
pub struct Logger<'cb> { /* private fields */ }
Expand description

Wrapper around the underlying xmpp_log_t struct.

The best option to get a logger is to call Logger::default(). It will return you a logger that is tied into Rust logging facility provided by log crate. This functionality is available when compiling with the default rust-log feature.

This struct implements:

  • Eq by comparing internal pointers
  • Hash by hashing internal pointer
  • Send

Implementations§

source§

impl<'cb> Logger<'cb>

source

pub fn new<CB>(handler: CB) -> Selfwhere CB: Fn(LogLevel, &str, &str) + Send + 'cb,

Create a new custom logger.

The callback argument will be called every time a log message needs to be printed.

source

pub fn new_internal(log_level: LogLevel) -> Logger<'static>

xmpp_get_default_logger

This method returns default libstrophe logger that just outputs log lines to stderr. Use it if you compile without rust-log feature and want a quick debug log output.

source

pub fn new_null() -> Logger<'static>

This method returns null logger that doesn’t output any information.

source

pub fn log(&self, level: LogLevel, area: &str, msg: &str)

Trait Implementations§

source§

impl Debug for Logger<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Logger<'static>

source§

fn default() -> Self

Return a new logger that logs to standard Rust logging facilities.

Logging facilities are provided by log crate. Only available when compiling with rust-log feature.

source§

impl Drop for Logger<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Hash for Logger<'_>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<Logger<'_>> for Logger<'_>

source§

fn eq(&self, other: &Logger<'_>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Logger<'_>

source§

impl Send for Logger<'_>

Auto Trait Implementations§

§

impl<'cb> !RefUnwindSafe for Logger<'cb>

§

impl<'cb> !Sync for Logger<'cb>

§

impl<'cb> Unpin for Logger<'cb>

§

impl<'cb> !UnwindSafe for Logger<'cb>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.