logger

package
v0.0.0-...-0fb446c Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package logger defines the logger interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

Debug logs at LevelDebug.

func DebugContext

func DebugContext(ctx context.Context, msg string, args ...any)

DebugContext logs at LevelDebug with the given context.

func ErrAttr

func ErrAttr(err error) slog.Attr

ErrAttr 错误类型Attr

func Error

func Error(msg string, args ...any)

Error logs at LevelError.

func ErrorContext

func ErrorContext(ctx context.Context, msg string, args ...any)

ErrorContext logs at LevelError with the given context.

func GetLevelByName

func GetLevelByName(name string) slog.Leveler

GetLevelByName human readable logger level

func Info

func Info(msg string, args ...any)

Info logs at LevelInfo.

func InfoContext

func InfoContext(ctx context.Context, msg string, args ...any)

InfoContext logs at LevelInfo with the given context.

func ReplaceSourceAttr

func ReplaceSourceAttr(groups []string, a slog.Attr) slog.Attr

ReplaceSourceAttr source 格式化为 dir/file:line 格式

func SetHandler

func SetHandler(handler slog.Handler)

SetHandler set logger

func SetLevel

func SetLevel(level slog.Leveler)

SetLevel init default logger with level

func Warn

func Warn(msg string, args ...any)

Warn logs at LevelWarn.

func WarnContext

func WarnContext(ctx context.Context, msg string, args ...any)

WarnContext logs at LevelWarn with the given context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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