Struct systemd_journal_logger::JournalLog[][src]

pub struct JournalLog<K, V> { /* fields omitted */ }
Expand description

A systemd journal logger.

Implementations

Create a logger which adds extra fields to every log entry.

Journal fields

extra_fields is a sequence of key value pairs to add as extra fields to every log entry logged through the new logger. The extra fields will be appended to the standard journal fields written by the logger.

Restrictions on field names

Each key in the sequence must be a valid journal field name, i.e. contain only uppercase alphanumeric characters and the underscore, and it must not start with an underscore.

Invalid keys in extra_fields are escaped with escape_journal_key, which transforms them to ASCII uppercase and replaces all invalid characters with underscores.

extra_fields should not contain any of the journal fields already added by this logger; while journald supports multiple values for a field journald clients may not handle unexpected multi-value fields properly and likely show only the first value. Specifically even journalctl will only shouw the first MESSAGE value of journal entries.

See the crate documentation at crate for details about the standard journal fields this logger uses.

Restrictions on values

There are no restrictions on the value.

Trait Implementations

The Log interface for JournalLog.

Whether this logger is enabled.

Always returns true.

Send the given record to the systemd journal.

Errors

Panic if sending the record to journald fails, i.e. if journald is not running.

Flush log records.

A no-op for journal logging.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.