barkslogger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package barkslogger manages everything related slog handler that's to be used by bark client.

Index

Constants

View Source
const (
	LvlPanic   = slog.Level(10)
	LvlAlert   = slog.Level(9)
	LvlError   = slog.Level(8)
	LvlWarning = slog.Level(4)
	LvlNotice  = slog.Level(3)
	LvlInfo    = slog.Level(0)
	LvlDebug   = slog.Level(-4)
)

Constants for custom log levels in bark.

Variables

This section is empty.

Functions

func New

func New(writer io.Writer) *slog.Logger

New creates a new logger of type slog.Logger.

func NewWithCustomHandler

func NewWithCustomHandler(handler slog.Handler) *slog.Logger

NewWithCustomHandler creates a new logger of type slog.Logger with custom slog.Handler object.

func Options

func Options() *slog.HandlerOptions

Options returns slog.HandlerOptions which defines custom log levels.

Types

type BarkSlogHandler

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

BarkSlogHandler implements interface slog.Handler.

func NewBarkSlogHandler

func NewBarkSlogHandler(out io.Writer) *BarkSlogHandler

NewBarkSlogHandler returns an object of BarkSlogHandler

func (*BarkSlogHandler) Enabled

func (handle *BarkSlogHandler) Enabled(_ context.Context, level slog.Level) bool

func (*BarkSlogHandler) Handle

func (handle *BarkSlogHandler) Handle(ctx context.Context, record slog.Record) error

Handle is an implementation of slog.Handler interface's methods for BarkSlogHandler.

func (*BarkSlogHandler) WithAttrs

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

func (*BarkSlogHandler) WithGroup

func (handle *BarkSlogHandler) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

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