zap

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

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEncoder

func DefaultEncoder() zapcore.Encoder

DefaultEncoder creates a default zapcore.Encoder with json format

func DefaultEncoderConfig

func DefaultEncoderConfig() zapcore.EncoderConfig

func DefaultLumberjackLogger

func DefaultLumberjackLogger() *lumberjack.Logger

DefaultLumberjackLogger creates a default lumberjack.Logger 1. Backup will not be cleaned up automatically 2. Compress every 200MB, not rotate by time

func DefaultOption

func DefaultOption() []zap.Option

DefaultOption creates some zap options

func NewLogger

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

Types

type Plugin

type Plugin = zapcore.Core

func NewFilePlugin

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

NewFilePlugin The Lumberjack logger holds the file but does not expose the sync method, so there is no way to take advantage of the sync feature of zap. Therefore, an additional closer is returned, and it is necessary to ensure that the close is completed before the process exits to ensure that all the written content can be flashed to disk.

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