Documentation
¶
Overview ¶
Package ulog exposes logging via a Go interface.
ulog has three implementations of the Logger interface: a Go standard library "log" package Logger, a kernel syslog (dmesg) Logger, and a test Logger that logs via a test's testing.TB.Logf. To use the test logger import "ulog/ulogtest".
Index ¶
Constants ¶
This section is empty.
Variables ¶
var KernelLog = &KLog{ LogLevel: uintptr(KLogInfo), }
KernelLog is a logger that prints to the kernel syslog buffer.
Default log level is KLogInfo.
If the syslog buffer cannot be written to, KernelLog falls back to Log.
Functions ¶
This section is empty.
Types ¶
type KLog ¶
type KLog struct {
// FD for /dev/kmsg if it was openable.
*os.File
// LogLevel is the LogLevel to print with.
//
// Should only be accessed atomically.
LogLevel uintptr
}
KLog is a logger to the kernel sysloBg buffer.
func (*KLog) SetConsoleLogLevel ¶
SetConsoleLogLevel sets the console level with syslog(2).
After this call, only messages with a level value lower than the one specified will be printed to console by the kernel.
func (*KLog) SetLogLevel ¶
SetLogLevel sets the level that Printf and Print log to syslog with.