logger

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultLevel the default log level
	DefaultLevel = zapcore.DebugLevel

	// DefaultTimeLayout the default time layout
	DefaultTimeLayout = timeutils.CSTLayout
)

Variables

This section is empty.

Functions

func NewJSONLogger

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

NewJSONLogger return a json-encoder zap logger,

Types

type Option

type Option func(*option)

Option custom setup config

func WithDebugLevel

func WithDebugLevel() Option

WithDebugLevel only greater than 'level' will output

func WithEnableConsole

func WithEnableConsole() Option

WithEnableConsole enable write log to os.Stdout or os.Stderr

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 WithFilePath

func WithFilePath(filename string) Option

WithFilePath write log to some file

func WithFileRotationP

func WithFileRotationP(filename string) Option

WithFileRotationP write log to some file with rotation

func WithIOWriter

func WithIOWriter(writer io.Writer) Option

WithIOWriter write log to writer

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

Jump to

Keyboard shortcuts

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