logman

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug = slog.Debug
	Info  = slog.Info
	Warn  = slog.Warn
	Error = slog.Error
)

Functions

func AutoWriter

func AutoWriter(name string) io.Writer

func Fatal

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

func FileWriter

func FileWriter(name string) *lumberjack.Logger

func NewLogger

func NewLogger(name string) *slog.Logger

func SetDefault

func SetDefault(args *Config)

Types

type Config

type Config struct {
	Level    string `note:"日志级别 debug|info|warn|error"`
	Target   string `note:"日志输出设备 both|file|null|stdout|stderr"`
	Storage  string `note:"日志文件存储目录"`
	Filename string `note:"默认日志文件名"`
}

type Logger

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

func Named

func Named(name string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(msg string, args ...any)

func (*Logger) Error

func (l *Logger) Error(msg string, args ...any)

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, args ...any)

func (*Logger) Info

func (l *Logger) Info(msg string, args ...any)

func (*Logger) Warn

func (l *Logger) Warn(msg string, args ...any)

Jump to

Keyboard shortcuts

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