Skip to main content

PlatformSink

Enum PlatformSink 

Source
pub enum PlatformSink {
    Stdout,
    File(File),
    OsLog,
    Journald(Option<UnixDatagram>),
    UringFile(File),
}
Expand description

Unified interface for platform-native log output.

Variants§

§

Stdout

Standard output fallback.

§

File(File)

File sink fallback.

§

OsLog

Native OS Log on macOS.

§

Journald(Option<UnixDatagram>)

Systemd Journald socket on Linux.

§

UringFile(File)

Available on Linux and crate feature uring only.

Linux io_uring-backed file sink. Enabled with the uring feature. Only compiles on Linux — see docs/adr/0011-io-uring-file-sink.md for the current implementation status.

The variant currently stores the underlying File and delegates writes to the standard synchronous path; the io_uring submission-queue integration lands in Phase 20.1. Consumers can already select this variant to future-proof their sink pipeline, and the io-uring dependency is resolved so the SQE wiring is drop-in.

Implementations§

Source§

impl PlatformSink

Source

pub fn from_config(config: &Config) -> Self

Build a sink from the given crate::config::Config.

Inspects logging_destinations in order:

  • File(path) → open for append
  • Stdout → stdout
  • Network(_) → skipped (not yet implemented)

Falls back to PlatformSink::native() if no destination matches.

Source

pub fn native() -> Self

Detect and return the best native sink for the current OS.

Source

pub fn emit(&mut self, level: &str, payload: &[u8])

Write a formatted log payload to this sink.

Trait Implementations§

Source§

impl Debug for PlatformSink

Source§

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

Formats the value using the given formatter. 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 = !

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.