pub enum KnownLogTarget {
    Console,
    Kmsg,
    Journal,
    Syslog,
    Null,
    Auto,
}
Expand description

Known log targets documented in the log control interface or systemctl(1).

Note that systemctl does not validate the log target; systemctl service-log-target passes any given string to the service.

This enum represents all log targets documented at various places, and their semantics.

Implementations of LogControl1 can use this enum to parse known targets, or entirely ignore it and handle the target themselves; the latter allows services to implement their own proprietary log targets.

Variants§

§

Console

Log to the console or standard output.

§

Kmsg

The kernel ring message buffer.

Normally not used by userspace services.

§

Journal

Log to the journal natively.

Prefer this other log targets when running under systemd, because this log target retains all structured data.

See stderr_connected_to_journal to determine whether the current process is already connected to the journal (i.e. its stderr goes directly into the systemd journal).

§

Syslog

The legacy syslog interface.

Services which use systemd should prefer the Journal interface.

§

Null

Disable all logging.

Note that even though this target is not documented in the logcontrol interface definition, the systemctl(1) manpage mentions it for the service-log-target command.

§

Auto

Automatically log to console or journal.

If the stdout or stderr streams of the current process are connected to the systemd journal this is equivalent to Journal. Otherwise it’s Console.

See stderr_connected_to_journal for a function which implements this check.

Note that even though this target is not documented in the logcontrol interface definition, the systemctl(1) manpage mentions it for the service-log-target command.

Implementations§

source§

impl KnownLogTarget

source

pub fn as_str(self) -> &'static str

Convert to the corresponding string representation.

Trait Implementations§

source§

impl Clone for KnownLogTarget

source§

fn clone(&self) -> KnownLogTarget

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for KnownLogTarget

source§

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

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

impl Display for KnownLogTarget

source§

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

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

impl PartialEq for KnownLogTarget

source§

fn eq(&self, other: &KnownLogTarget) -> 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 TryFrom<&str> for KnownLogTarget

§

type Error = LogTargetParseError

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

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for KnownLogTarget

source§

impl Eq for KnownLogTarget

source§

impl StructuralEq for KnownLogTarget

source§

impl StructuralPartialEq for KnownLogTarget

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.