kmsg

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kmsg logs to the kernel's log buffer, the one place a daemon with no terminal and no journald yet can reach from the initramfs on. journald reads the buffer once it runs, under the identifier the records carry.

Index

Constants

View Source
const Path = "/dev/kmsg"

Path is the device the kernel takes log records from.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler writes each slog record as one kernel log record, with its severity in the record's priority and without the time the kernel stamps on it.

func NewHandler

func NewHandler(w io.Writer, pid int, level slog.Leveler) *Handler

NewHandler logs at level and above to w, naming pid as the logging process. Each record reaches w in a single Write, as /dev/kmsg needs.

func (*Handler) Enabled

func (h *Handler) Enabled(ctx context.Context, l slog.Level) bool

Enabled implements slog.Handler.

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, r slog.Record) error

Handle implements slog.Handler.

func (*Handler) WithAttrs

func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs implements slog.Handler.

func (*Handler) WithGroup

func (h *Handler) WithGroup(name string) slog.Handler

WithGroup implements slog.Handler.

Jump to

Keyboard shortcuts

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