logger

package module
v0.0.0-...-c250bfa Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 6 Imported by: 0

README

logger

介绍

{以下是 Gitee 平台说明,您可以替换此简介 Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 https://gitee.com/enterprises}

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Skip        = zap.Skip
	Binary      = zap.Binary
	Bool        = zap.Bool
	Boolp       = zap.Boolp
	ByteString  = zap.ByteString
	Complex128  = zap.Complex128
	Complex128p = zap.Complex128p
	Complex64   = zap.Complex64
	Complex64p  = zap.Complex64p
	Float64     = zap.Float64
	Float64p    = zap.Float64p
	Float32     = zap.Float32
	Float32p    = zap.Float32p
	Int         = zap.Int
	Intp        = zap.Intp
	Int64       = zap.Int64
	Int64p      = zap.Int64p
	Int32       = zap.Int32
	Int32p      = zap.Int32p
	Int16       = zap.Int16
	Int16p      = zap.Int16p
	Int8        = zap.Int8
	Int8p       = zap.Int8p
	String      = zap.String
	Stringp     = zap.Stringp
	Uint        = zap.Uint
	Uintp       = zap.Uintp
	Uint64      = zap.Uint64
	Uint64p     = zap.Uint64p
	Uint32      = zap.Uint32
	Uint32p     = zap.Uint32p
	Uint16      = zap.Uint16
	Uint16p     = zap.Uint16p
	Uint8       = zap.Uint8
	Uint8p      = zap.Uint8p
	Uintptr     = zap.Uintptr
	Uintptrp    = zap.Uintptrp
	Reflect     = zap.Reflect
	Namespace   = zap.Namespace
	Stringer    = zap.Stringer
	Time        = zap.Time
	Timep       = zap.Timep
	Stack       = zap.Stack
	StackSkip   = zap.StackSkip
	Duration    = zap.Duration
	Durationp   = zap.Durationp
	Any         = zap.Any
)

Functions

func Sync

func Sync() error

Types

type EncoderType

type EncoderType string
const (
	ConsoleEncoder EncoderType = "console"
	JSONEncoder    EncoderType = "json"
)

type Field

type Field = zap.Field

type Level

type Level = zapcore.Level
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	DebugLevel Level = zapcore.DebugLevel
	// InfoLevel is the default logging priority.
	InfoLevel Level = zapcore.InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual
	// human review.
	WarnLevel Level = zapcore.WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	ErrorLevel Level = zapcore.ErrorLevel
	// DPanicLevel logs are particularly important errors. In development the
	// logger panics after writing the message.
	DPanicLevel Level = zapcore.DPanicLevel
	// PanicLevel logs a message, then panics.
	PanicLevel Level = zapcore.PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel Level = zapcore.FatalLevel
)

type Option

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

func WithCaller

func WithCaller(enabled bool) Option

WithCaller .

func WithCallerSkip

func WithCallerSkip(skip int) Option

WithCallerSkip .

func WithEncoderType

func WithEncoderType(encoderType EncoderType) Option

WithEncoderType .

func WithLevelAt

func WithLevelAt(level Level) Option

WithLevelAt .

func WithMessageKey

func WithMessageKey(messageKey string) Option

WithMessageKey .

func WithOutput

func WithOutput(output io.Writer) Option

WithOutput .

type Rotate

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

Rotate .

func NewRotate

func NewRotate(opts ...RotateOption) *Rotate

NewRotate .

func (*Rotate) Writer

func (r *Rotate) Writer() io.Writer

Writer .

type RotateOption

type RotateOption func(*Rotate)

func WithCompress

func WithCompress(isCompress bool) RotateOption

WithCompress set log file backup is compress.

default false.

func WithFileName

func WithFileName(filename string) RotateOption

WithFileName set log file name.

default zap.log.

func WithLocalTime

func WithLocalTime(isLocalTime bool) RotateOption

WithLocalTime set log file name suffix.

default false.

func WithMaxAge

func WithMaxAge(maxAge int) RotateOption

WithMaxAge set log file max age.

default 7 day.

func WithMaxBackups

func WithMaxBackups(maxBackups int) RotateOption

WithMaxBackups set log file max backups.

default 10.

func WithMaxSize

func WithMaxSize(maxSize int) RotateOption

WithMaxSize set log file max size unit M.

default 500M.

type ZapLogger

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

ZapLogger .

func New

func New(opt ...Option) *ZapLogger

New .

func (*ZapLogger) DPanic

func (z *ZapLogger) DPanic(msg string, fields ...Field)

func (*ZapLogger) DPanicf

func (z *ZapLogger) DPanicf(format string, v ...interface{})

func (*ZapLogger) Debug

func (z *ZapLogger) Debug(msg string, fields ...Field)

func (*ZapLogger) Debugf

func (z *ZapLogger) Debugf(format string, v ...interface{})

func (*ZapLogger) Error

func (z *ZapLogger) Error(msg string, fields ...Field)

func (*ZapLogger) Errorf

func (z *ZapLogger) Errorf(format string, v ...interface{})

func (*ZapLogger) Fatal

func (z *ZapLogger) Fatal(msg string, fields ...Field)

func (*ZapLogger) Fatalf

func (z *ZapLogger) Fatalf(format string, v ...interface{})

func (*ZapLogger) Info

func (z *ZapLogger) Info(msg string, fields ...Field)

func (*ZapLogger) Infof

func (z *ZapLogger) Infof(format string, v ...interface{})

func (*ZapLogger) Panic

func (z *ZapLogger) Panic(msg string, fields ...Field)

func (*ZapLogger) Panicf

func (z *ZapLogger) Panicf(format string, v ...interface{})

func (*ZapLogger) Sync

func (z *ZapLogger) Sync() error

func (*ZapLogger) Warn

func (z *ZapLogger) Warn(msg string, fields ...Field)

func (*ZapLogger) Warnf

func (z *ZapLogger) Warnf(format string, v ...interface{})

Jump to

Keyboard shortcuts

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