Version: v1.0.7 Latest Latest

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 7 Imported by: 0




View Source
const (
	// DefaultLevel the default log level
	DefaultLevel = zapcore.InfoLevel
	// DefaultTimeLayout the default time layout;
	DefaultTimeLayout = time.RFC3339


This section is empty.


func NewJSONLogger

func NewJSONLogger(opts ...Option) (*zap.Logger, error)

NewJSONLogger return a json-encoder zap logger,


type Option

type Option func(*option)

Option custom setup config

func WithDebugLevel

func WithDebugLevel() Option

WithDebugLevel only greater than 'level' will output

func WithErrorLevel

func WithErrorLevel() Option

WithErrorLevel only greater than 'level' will output

func WithField

func WithField(key, value string) Option

WithField add some field(s) to log

func WithFile

func WithFile(file string) Option

WithFile write log to some file

func WithFileP

func WithFileP(file string) Option

WithFileP write log to some file

func WithFileRotationP

func WithFileRotationP(file string) Option

WithFileRotationP write log to some file with rotation

func WithInfoLevel

func WithInfoLevel() Option

WithInfoLevel only greater than 'level' will output

func WithTimeLayout

func WithTimeLayout(timeLayout string) Option

WithTimeLayout custom time format

func WithWarnLevel

func WithWarnLevel() Option

WithWarnLevel only greater than 'level' will output

Source Files

Jump to

Keyboard shortcuts

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