log

package
v0.0.0-...-278ce41 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEncoder

func DefaultEncoder() zapcore.Encoder

DefaultEncoder default use json.

func DefaultEncoderConfig

func DefaultEncoderConfig() zapcore.EncoderConfig

func DefaultLumberjackLogger

func DefaultLumberjackLogger() *lumberjack.Logger

DefaultLumberjackLogger 1.不会自动清理backup 2.每200mb压缩一次,不按时间rotate

func DefaultOption

func DefaultOption() []zap.Option

func MicroServerWrapper

func MicroServerWrapper(logger *zap.Logger) server.HandlerWrapper

func NewLogger

func NewLogger(plugin zapcore.Core, options ...zap.Option) *zap.Logger

NewLogger new logger. NOTE: 一些option选项是无法覆盖的

Types

type Plugin

type Plugin = zapcore.Core

func NewFilePlugin

func NewFilePlugin(filePath string, enabler zapcore.LevelEnabler) (Plugin, io.Closer)

NewFilePlugin use lumberjack.Logger writer to new zapcore.Core. lumberjack.Logger虽然持有File,但没有暴露sync方法,所以没办法利用zap的sync特性。 所以额外返回一个closer,需要保证在进程退出前close以保证写入的内容可以全部刷到到磁盘。

func NewPlugin

func NewPlugin(writer zapcore.WriteSyncer, enabler zapcore.LevelEnabler) Plugin

func NewStderrPlugin

func NewStderrPlugin(enabler zapcore.LevelEnabler) Plugin

func NewStdoutPlugin

func NewStdoutPlugin(enabler zapcore.LevelEnabler) Plugin

Jump to

Keyboard shortcuts

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