mlog

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Env

func Env() log.Valuer

Env 获取服务环境

func ID

func ID() log.Valuer

ID 获取服务ID

func Name

func Name() log.Valuer

Name 获取服务名称

func NewHelper

func NewHelper(logger Logger, module, domain string) *log.Helper

NewHelper new a log helper.

func RecoveryHandle

func RecoveryHandle(_ context.Context, req, err interface{}) error

RecoveryHandle 错误处理

func Version

func Version() log.Valuer

Version 获取服务版本

Types

type AliyunLogConfig

type AliyunLogConfig interface {
	GetAccessKey() string
	GetAccessSecret() string
	GetEndpoint() string
	GetSecurityToken() string
	GetExpireTime() string
	GetProject() string
	GetStore() string
}

type Logger

type Logger interface {
	log.Logger
}

func New

func New(c *conf.Log) (l Logger)

New a logger.

func NewAliYunLog

func NewAliYunLog(c AliyunLogConfig) Logger

NewAliYunLog new an aliyun logger with options.

func NewLogger

func NewLogger(l Logger) Logger

NewLogger new a logger.

func NewLokiLogger

func NewLokiLogger(c LokiConfig) Logger

NewLokiLogger create a new loki logger

func NewSlog

func NewSlog(c SLogConfig) Logger

NewSlog returns a new slog logger.

func NewStdoutLogger

func NewStdoutLogger(write io.Writer) Logger

NewStdoutLogger new a stdout logger.

func NewZapLogger

func NewZapLogger(c ZapLogConfig) Logger

NewZapLogger new a zap logger.

type LokiConfig

type LokiConfig interface {
	GetUrl() string
}

type SLogConfig

type SLogConfig interface {
	GetJson() bool
}

type ZapLogConfig

type ZapLogConfig interface {
	GetJson() bool
}

Jump to

Keyboard shortcuts

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