sqlogger

package module
v0.0.0-...-1c230f7 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

README

sqlogger

Simple slog handler writing to SQLite, with simple log rotation and additional coloured stdout logs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineCurrentName

func DetermineCurrentName() (string, error)

Types

type Options

type Options struct {
	// Level reports the minimum level to log.
	// Levels with lower levels are discarded.
	// If nil, the Handler uses [slog.LevelInfo].
	Level slog.Leveler

	// Set to true to disable color output to console
	NoColor bool
	// contains filtered or unexported fields
}

type SQLogger

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

func NewSQLogger

func NewSQLogger(opts *Options) (*SQLogger, error)

func (*SQLogger) Close

func (h *SQLogger) Close()

func (*SQLogger) Enabled

func (h *SQLogger) Enabled(ctx context.Context, level slog.Level) bool

func (*SQLogger) Handle

func (h *SQLogger) Handle(c context.Context, r slog.Record) error

func (*SQLogger) Name

func (h *SQLogger) Name() string

func (*SQLogger) Rotate

func (h *SQLogger) Rotate() error

func (*SQLogger) WithAttrs

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

func (*SQLogger) WithGroup

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

Jump to

Keyboard shortcuts

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