logutils

package
v0.0.0-...-f70a1fa Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultLogPath = "./log"
)

Variables

This section is empty.

Functions

func CapitalLevelEncoder

func CapitalLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)

CapitalLevelEncoder 自定义等级格式

func FullCallerEncoder

func FullCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)

func ISO8601TimeEncoder

func ISO8601TimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

ISO8601TimeEncoder 自定义时间格式

func NewHertzLog

func NewHertzLog(opts ...Option)

func NewKitexLog

func NewKitexLog(opts ...Option)

func NewLumberjackWriteSyncer

func NewLumberjackWriteSyncer(fileName string,
	config *OptionConfig) zapcore.WriteSyncer

func NewRotateWriteSyncer

func NewRotateWriteSyncer(fileName string,
	config *OptionConfig) zapcore.WriteSyncer

func NewWriteSyncer

func NewWriteSyncer(fileName string, config *OptionConfig) zapcore.WriteSyncer

func ShortCallerEncoder

func ShortCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)

func StringDurationEncoder

func StringDurationEncoder(d time.Duration, enc zapcore.PrimitiveArrayEncoder)

StringDurationEncoder 自定义时间格式

Types

type Level

type Level string
const (
	LevelTrace  Level = "trace"
	LevelDebug  Level = "debug"
	LevelInfo   Level = "info"
	LevelNotice Level = "notice"
	LevelWarn   Level = "warn"
	LevelError  Level = "error"
	LevelFatal  Level = "fatal"
)

func (Level) HLogLevel

func (level Level) HLogLevel() hlog.Level

func (Level) KLogLevel

func (level Level) KLogLevel() klog.Level

KLogLevel return kitex log level

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithCompress

func WithCompress(compress bool) Option

func WithMaxAge

func WithMaxAge(maxAge int) Option

func WithMaxBackups

func WithMaxBackups(maxBackups int) Option

func WithMaxSize

func WithMaxSize(maxSize int) Option

func WithOutputMode

func WithOutputMode(outputMode int) Option

func WithPath

func WithPath(path string) Option

func WithRotationDuration

func WithRotationDuration(rotationDuration time.Duration) Option

func WithSuffix

func WithSuffix(suffix string) Option

type OptionConfig

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

func DefaultOptionConfig

func DefaultOptionConfig() *OptionConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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