pub fn connected_to_journal() -> bool
Expand description

Whether this process can be automatically upgraded to native journal logging.

Inspects the $JOURNAL_STREAM environment variable and compares the device and inode numbers in this variable against the stderr file descriptor.

Return true if they match, and false otherwise (or in case of any IO error).

For services normally logging to stderr but also supporting systemd-style structured logging, it is recommended to perform this check and thenupgrade to the native systemd journal protocol if possible.

See section “Automatic Protocol Upgrading” in systemd documentation for more information.