ulogjournal

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLevelKey = "lvl"

Variables

This section is empty.

Functions

func IsJournalStream

func IsJournalStream(file statter) bool

Returns whether the file is the same as $JOURNAL_STREAM. If file is nil, os.Stderr is checked.

https://systemd.io/JOURNAL_NATIVE_PROTOCOL/

Why bother with this environment variable check? A service program invoked by systemd might employ shell-style I/O redirection on invoked subprograms, and those should likely not upgrade to the native Journal protocol, but instead continue to use the redirected file descriptors passed to them.

func Maybe

func Maybe(w io.Writer) io.Writer

Maybe returns an io.Writer usable with ulog.WithWriter.

This will be Journal iff the given io.Writer is JOURNAL_STREAM, os.Stderr otherwise. If w == nil then os.Stderr is used instead.

func Print

func Print(msg string, fields ...ulog.Field)

Types

type Journal

type Journal struct{ LevelKey string }

Journal prints log message to systemd-journald's socket. The priority level is deduced from the LevelKey value, or PriInfo by default.

func (Journal) Print

func (u Journal) Print(msg string, fields ...ulog.Field) error

Print the message with the fields.

func (Journal) Write

func (u Journal) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL