pub trait LogControl1 {
    // Required methods
    fn level(&self) -> LogLevel;
    fn set_level(&mut self, level: LogLevel) -> Result<(), LogControl1Error>;
    fn target(&self) -> &str;
    fn set_target<S: AsRef<str>>(
        &mut self,
        target: S
    ) -> Result<(), LogControl1Error>;
    fn syslog_identifier(&self) -> &str;
}
Expand description

Abstract representation of the LogControl1 interface.

Bridges a DBus frontend to a backend logging framework.

Implementations should choose the initial log target automatically, according to whether their stderr is already connected to the systemd journal directly, per $JOURNAL_STREAM (see systemd.exec(5)). stderr_connected_to_journal implements this check.

Required Methods§

source

fn level(&self) -> LogLevel

Get the currently configured log level.

source

fn set_level(&mut self, level: LogLevel) -> Result<(), LogControl1Error>

Set the level of the underlying log framework.

source

fn target(&self) -> &str

Get the currently configured log target.

source

fn set_target<S: AsRef<str>>( &mut self, target: S ) -> Result<(), LogControl1Error>

Set the target of the underlying log framework.

Systemd documents some known targets both in the LogControl1 interface definition, as well as in the systemctl(1) manpage. The KnownLogTarget enum represents all these known targets.

However, implementations are free to use their own proprietary targets; systemctl service-log-target actually forwards any given string to the service.

It’s a good idea though to support at least KnownLogTarget::Console and KnownLogTarget::Journal.

source

fn syslog_identifier(&self) -> &str

Get the syslog identifier.

Object Safety§

This trait is not object safe.

Implementors§