logger

package
v0.0.0-...-9dac4f2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: BSD-2-Clause, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutSep = ","
)

Variables

This section is empty.

Functions

func FieldContext

func FieldContext(ctx context.Context) log.Field

func FieldError

func FieldError(err error) log.Field

func FieldInt32

func FieldInt32(key string, val int32) log.Field

func FieldInt64

func FieldInt64(key string, val int64) log.Field

func FieldInterface

func FieldInterface(key string, val interface{}) log.Field

func FieldMap

func FieldMap(items map[string]interface{}) log.Field

func FieldString

func FieldString(key string, val string) log.Field

func New

func New(loggerConf *Config) (log.Logger, func(), error)

func NewDevNullLog

func NewDevNullLog(w io.Writer) log.Logger

func NewFields

func NewFields() log.IField

func NewTextEncoder

func NewTextEncoder(config zapcore.EncoderConfig) zapcore.Encoder

Types

type Config

type Config struct {
	Out   string `json:"out,omitempty"`
	Level string `json:"level,omitempty"`
	File  *File  `json:"file,omitempty"`
	Type  string `json:"type,omitempty"`
	// 默认:0-default, 1-simple
	Model int32 `json:"model,omitempty"`
}

Config 日志配置

func (*Config) GetFile

func (x *Config) GetFile() *File

func (*Config) GetLevel

func (x *Config) GetLevel() string

func (*Config) GetModel

func (x *Config) GetModel() int32

func (*Config) GetOut

func (x *Config) GetOut() string

func (*Config) GetType

func (x *Config) GetType() string

type File

type File struct {
	Path       string `json:"path,omitempty"`
	FileName   string `json:"file_name,omitempty"`
	MaxSize    int32  `json:"max_size,omitempty"`
	MaxBackups int32  `json:"max_backups,omitempty"`
	MaxAge     int32  `json:"max_age,omitempty"`
	Compress   bool   `json:"compress,omitempty"`
}

func (*File) GetCompress

func (x *File) GetCompress() bool

func (*File) GetFileName

func (x *File) GetFileName() string

func (*File) GetMaxAge

func (x *File) GetMaxAge() int32

func (*File) GetMaxBackups

func (x *File) GetMaxBackups() int32

func (*File) GetMaxSize

func (x *File) GetMaxSize() int32

func (*File) GetPath

func (x *File) GetPath() string

Jump to

Keyboard shortcuts

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