log

package
v0.0.0-...-adb5103 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileWriter

func NewFileWriter(file *FileOption) io.Writer

Types

type FileOption

type FileOption struct {
	Filename string //指定日志存储位置, 如按日期分割, filename包含%Y-%m-%d.log,/opt/logs/xxx/%Y-%m-%d.log
	MaxSize  int    //日志的最大大小(M)
	MaxAge   int    //日志文件存储最大天数
}

==================文件存储日志==================

type Options

type Options struct {
	//Level default INFO
	Level zapcore.Level
	//ServiceName serviceName
	ServiceName string
	//调用者堆栈层级
	Skip int
	//日志存储器
	Writer io.Writer
}

type ZapLogger

type ZapLogger struct {
	*zap.SugaredLogger
	Sync func() error
}

func NewZapLogger

func NewZapLogger(opt *Options) *ZapLogger

func (*ZapLogger) Log

func (l *ZapLogger) Log(level klog.Level, keyvals ...interface{}) error

see https://go-kratos.dev/docs/component/log

Jump to

Keyboard shortcuts

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