Journald

journald

github.com/rs/zerolog/journald

import "github.com/rs/zerolog/journald"

Variables

SendFunc is the function used to send logs to journald. It can be replaced in tests for mocking. If nil, journal.Send is used directly. This variable should only be modified in tests and must not be changed while the writer is in use. Tests that modify this variable should not use t.Parallel().

Source: journald/journald.go:36

var SendFunc func(string, journal.Priority, map[string]string) error

Functions

func NewJournalDWriter() io.Writer

Source: journald/journald.go:42

NewJournalDWriter returns a zerolog log destination to be used as parameter to New() calls. Writing logs to this writer will send the log messages to journalD running in this system.

Example
{
	log := zerolog.New(NewJournalDWriter())
	log.Info().Str("foo", "bar").Uint64("small", 123).Float64("float", 3.14).Uint64("big", 1152921504606846976).Msg("Journal Test")

}

Edit this page

Sourcey-generated documentation mirror for rs/zerolog (MIT), built from source at a pinned commit.Docs by Sourcey