bootstrap

package
v0.0.0-...-8529627 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeLocal      = "local"
	ModeDevelop    = "dev"
	ModeTest       = "test"
	ModeProduction = "prod"
)

Variables

This section is empty.

Functions

func Debug

func Debug(message string, kvs ...any)

Debug 打印debug级别信息

func Error

func Error(message string, kvs ...any)

Error 打印error级别信息

func Fatal

func Fatal(message string, kvs ...any)

func GetMode

func GetMode() string

GetMode ...

func Info

func Info(message string, kvs ...any)

Info 打印info级别信息

func InitLogger

func InitLogger(options ...Option)

InitLogger 初始化日志配置

func IsDevelopment

func IsDevelopment() bool

IsDevelopment ...

func LoadConfig

func LoadConfig(path string) error

LoadConfig ...

func Sync

func Sync()

Sync 关闭时需要同步日志到输出

func Warn

func Warn(message string, kvs ...any)

Warn 打印warn级别信息

Types

type Logger

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

func WithCtx

func WithCtx(ctx context.Context) *Logger

func (*Logger) Debug

func (s *Logger) Debug(message string, kvs ...any)

Debug 打印debug级别信息

func (*Logger) Error

func (s *Logger) Error(message string, kvs ...any)

Error 打印error级别信息

func (*Logger) Fatal

func (s *Logger) Fatal(message string, kvs ...any)

func (*Logger) Info

func (s *Logger) Info(message string, kvs ...any)

Info 打印info级别信息

func (*Logger) Warn

func (s *Logger) Warn(message string, kvs ...any)

Warn 打印warn级别信息

type Option

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

func WithOption

func WithOption(key string, val any) Option

WithOption 设置日志打印的公共内容

type Valuer

type Valuer func(ctx context.Context) any

Jump to

Keyboard shortcuts

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