slog

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 7 Imported by: 3 modules, 2 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

Index

Constants

View Source
const (
	LogFileWritePermissions = 0600
	DefaultBufferSize       = 1_000
)

Variables

View Source
var MOCK_HANDLER = NewMockHandler()

Functions

func NewMessage

func NewMessage(logger *slog.Logger, level slog.Level, context contextpkg.Context) commonlog.Message

Types

type Backend

type Backend struct {
	Logger     *slog.Logger
	Writer     io.Writer
	BufferSize int
	Buffered   bool
	AddSource  bool
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend() *Backend

func (*Backend) AllowLevel

func (self *Backend) AllowLevel(level commonlog.Level, name ...string) bool

(commonlog.Backend interface)

func (*Backend) Configure

func (self *Backend) Configure(verbosity int, path *string)

(commonlog.Backend interface)

func (*Backend) GetMaxLevel

func (self *Backend) GetMaxLevel(name ...string) commonlog.Level

(commonlog.Backend interface)

func (*Backend) GetWriter

func (self *Backend) GetWriter() io.Writer

(commonlog.Backend interface)

func (*Backend) NewMessage

func (self *Backend) NewMessage(level commonlog.Level, depth int, name ...string) commonlog.Message

(commonlog.Backend interface)

func (*Backend) SetMaxLevel

func (self *Backend) SetMaxLevel(level commonlog.Level, name ...string)

(commonlog.Backend interface)

type Message

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

func (*Message) Send

func (self *Message) Send()

(commonlog.Message interface)

func (*Message) Set

func (self *Message) Set(key string, value any) commonlog.Message

(commonlog.Message interface)

type MockHandler

type MockHandler struct{}

func NewMockHandler

func NewMockHandler() *MockHandler

func (*MockHandler) Enabled

func (self *MockHandler) Enabled(context contextpkg.Context, level slog.Level) bool

(slog.Handler interface)

func (*MockHandler) Handle

func (self *MockHandler) Handle(context contextpkg.Context, record slog.Record) error

(slog.Handler interface)

func (*MockHandler) WithAttrs

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

(slog.Handler interface)

func (*MockHandler) WithGroup

func (self *MockHandler) WithGroup(name string) slog.Handler

(slog.Handler interface)

Jump to

Keyboard shortcuts

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