Skip to main content

Logger

Struct Logger 

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

Swift Logger backed by an OSLog handle.

Implementations§

Source§

impl Logger

Source

pub fn new(subsystem: &str, category: &str) -> Result<Self, LogError>

Creates a logger for a subsystem/category pair.

§Errors

Returns an error if either argument contains a NUL byte or the bridge fails.

Source

pub fn from_os_log(log: &OSLog) -> Result<Self, LogError>

Creates a logger from an existing OSLog handle.

§Errors

Returns an error if the bridge fails to create the logger wrapper.

Source

pub fn default() -> Self

Returns Logger().

Source

pub fn disabled() -> Self

Returns a disabled logger.

Source

pub fn log(&self, level: Level, message: &str)

Emits a message at one of the classic OSLogType levels.

Source

pub fn log_with_privacy(&self, level: Level, message: &str, privacy: Privacy)

Emits a message with an explicit privacy level.

Source

pub fn trace(&self, message: &str)

Source

pub fn debug(&self, message: &str)

Source

pub fn info(&self, message: &str)

Source

pub fn notice(&self, message: &str)

Source

pub fn warning(&self, message: &str)

Source

pub fn error(&self, message: &str)

Source

pub fn critical(&self, message: &str)

Source

pub fn fault(&self, message: &str)

Source

pub fn is_enabled(&self, level: Level) -> bool

Returns whether the underlying OSLog handle enables this classic level.

Source

pub fn signpost_id(&self) -> OSSignpostId

Generates a signpost identifier associated with this logger’s log handle.

Source

pub fn signpost_id_from_pointer<T>(&self, pointer: *const T) -> OSSignpostId

Generates a signpost identifier derived from a pointer.

Source

pub fn signposts_enabled(&self) -> bool

Returns whether signposts are enabled for this logger’s log handle.

Source

pub fn signpost_event(&self, id: OSSignpostId, name: &str, message: &str)

Source

pub fn signpost_interval_begin(&self, id: OSSignpostId, name: &str)

Source

pub fn signpost_animation_interval_begin(&self, id: OSSignpostId, name: &str)

Source

pub fn signpost_interval_end(&self, id: OSSignpostId, name: &str)

Trait Implementations§

Source§

impl Default for Logger

Source§

fn default() -> Self

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

impl Drop for Logger

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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, 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.