pfxlog

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 14 Imported by: 251

Documentation

Index

Constants

View Source
const ChannelKey = "_channel"

Variables

This section is empty.

Functions

func Debug added in v1.0.0

func Debug(args ...interface{})

func Debugf added in v1.0.0

func Debugf(format string, args ...interface{})

func Error added in v1.0.0

func Error(args ...interface{})

func Errorf added in v1.0.0

func Errorf(format string, args ...interface{})

func Filter added in v0.4.0

func Filter(sourceR io.Reader, options *Options)

func GlobalInit added in v0.4.0

func GlobalInit(level slog.Level, options *Options)

func Info added in v1.0.0

func Info(args ...interface{})

func Infof added in v1.0.0

func Infof(format string, args ...interface{})

func NewPrettyHandler added in v1.0.0

func NewPrettyHandler(level slog.Level, options *Options) slog.Handler

func Warn added in v1.0.0

func Warn(args ...interface{})

func Warnf added in v1.0.0

func Warnf(format string, args ...interface{})

Types

type Builder added in v0.5.0

type Builder struct {
	*slog.Logger
}

func Channel added in v1.0.0

func Channel(channel string) Builder

func Logger

func Logger() Builder

func (Builder) Debugf added in v1.0.0

func (b Builder) Debugf(format string, args ...interface{})

func (Builder) Errorf added in v1.0.0

func (b Builder) Errorf(format string, args ...interface{})

func (Builder) Infof added in v1.0.0

func (b Builder) Infof(format string, args ...interface{})

func (Builder) Warnf added in v1.0.0

func (b Builder) Warnf(format string, args ...interface{})

type Options added in v0.4.0

type Options struct {
	StartTimestamp time.Time
	AbsoluteTime   bool
	TrimPrefix     string

	ErrorLabel   string
	WarningLabel string
	InfoLabel    string
	DebugLabel   string

	TimestampColor string
	FunctionColor  string
	ChannelColor   string
	FieldsColor    string
	DefaultFgColor string

	TimestampFormat string
}

func DefaultOptions added in v0.4.0

func DefaultOptions() *Options

func (*Options) Color added in v0.4.0

func (options *Options) Color() *Options

func (*Options) NoColor added in v0.4.0

func (options *Options) NoColor() *Options

func (*Options) SetAbsoluteTime added in v0.4.0

func (options *Options) SetAbsoluteTime() *Options

func (*Options) SetTrimPrefix added in v0.4.0

func (options *Options) SetTrimPrefix(prefix string) *Options

func (*Options) Starting added in v0.4.0

func (options *Options) Starting(t time.Time) *Options

func (*Options) StartingToday added in v0.4.0

func (options *Options) StartingToday() *Options

type PrettyHandler added in v1.0.0

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

func (*PrettyHandler) Enabled added in v1.0.0

func (h *PrettyHandler) Enabled(_ context.Context, level slog.Level) bool

func (*PrettyHandler) Handle added in v1.0.0

func (h *PrettyHandler) Handle(_ context.Context, r slog.Record) error

func (*PrettyHandler) WithAttrs added in v1.0.0

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

func (*PrettyHandler) WithGroup added in v1.0.0

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

Directories

Path Synopsis
cmd
examples

Jump to

Keyboard shortcuts

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