Documentation ¶
Index ¶
Constants ¶
View Source
const ( LevelNotice slog.Level = 1 LevelCritical slog.Level = slog.LevelError + 1 LevelAlert slog.Level = slog.LevelError + 2 LevelEmergency slog.Level = slog.LevelError + 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler sends logs to the systemd journal. variable names must be in uppercase and consist only of characters, numbers and underscores, and may not begin with an underscore.
func NewHandler ¶
func (*Handler) Handle ¶
Handle handles the Record. It will only be called when Enabled returns true. The Context argument is as for Enabled. It is present solely to provide Handlers access to the context's values. Canceling the context should not affect record processing. (Among other things, log messages may be necessary to debug a cancellation-related problem.)
Handle methods that produce output should observe the following rules:
- If r.Time is the zero time, ignore the time.
- If r.PC is zero, ignore it.
- Attr's values should be resolved.
- If an Attr's key and value are both the zero value, ignore the Attr. This can be tested with attr.Equal(Attr{}).
- If a group's key is empty, inline the group's Attrs.
- If a group has no Attrs (even if it has a non-empty key), ignore it.
type Options ¶
type Options struct { Level slog.Leveler // ReplaceAttr is called on all non-builtin Attrs before they are written. // This can be useful for processing attributes to be in the correct format // for log statements outside of your own code as the journal only accepts // variables that are uppercase and consist only of characters, numbers and // underscores, and may not begin with an underscore. ReplaceAttr func(groups []string, a slog.Attr) slog.Attr // ReplaceGroup is called on all group names before they are written. This // can be useful for processing group names to be in the correct format for // log statements outside of your own code as the journal only accepts // variables that are uppercase and consist only of characters, numbers and // underscores, and may not begin with an underscore. ReplaceGroup func(group string) string }
Click to show internal directories.
Click to hide internal directories.