logger

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options *Options) (*zap.Logger, error)

New constructs a new Logger

Types

type Core

type Core struct {
	zapcore.LevelEnabler
	// contains filtered or unexported fields
}

Core zap syslog Core struct

func NewCore

func NewCore(level zapcore.LevelEnabler, encoder zapcore.Encoder, writer *syslog.Writer) *Core

NewCore return a new syslog zap Core nolint: gocritic

func (*Core) Check

func (core *Core) Check(entry zapcore.Entry, checked *zapcore.CheckedEntry) *zapcore.CheckedEntry

Check determines whether the supplied Entry should be logged nolint: gocritic

func (*Core) Sync

func (core *Core) Sync() error

Sync flushes buffered logs (if any).

func (*Core) With

func (core *Core) With(fields []zapcore.Field) zapcore.Core

With adds structured context to the Core.

func (*Core) Write

func (core *Core) Write(entry zapcore.Entry, fields []zapcore.Field) error

Write serializes the Entry and any Fields supplied at the log site and writes them to their destination. nolint: gocritic

type Options

type Options struct {
	// 日志 syslog 的 tag(日志文件路径)
	Tag string
	// Debug 模式,debug 时,只把日志输出到 stdout
	Debug bool
}

Options 日志相关配置

Jump to

Keyboard shortcuts

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