log

package
Version: v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0, MIT Imports: 4 Imported by: 8

Documentation

Index

Constants

View Source
const (
	LogInfo  = int(zapcore.InfoLevel)
	LogDebug = int(zapcore.DebugLevel)
	LogError = int(zapcore.ErrorLevel)
	LogFatal = int(zapcore.FatalLevel)
	LogPanic = int(zapcore.PanicLevel)
	LogWarn  = int(zapcore.WarnLevel)
)
View Source
const DefaultLevel = LogInfo

DefaultLevel is the default level where statements are logged. Change the value of this variable before init() to change the level of the default logger.

Variables

This section is empty.

Functions

func ConfigureDefaultLogger added in v1.4.6

func ConfigureDefaultLogger(output zapcore.WriteSyncer, level int, jsonFormat bool)

ConfigureDefaultLogger updates the default logger to wrap a provided kit logger.

func NewZapLogger added in v1.4.6

func NewZapLogger(output zapcore.WriteSyncer, encoder zapcore.Encoder, level int) *zap.Logger

Types

type Logger

type Logger interface {
	Info(keyvals ...interface{})
	Debug(keyvals ...interface{})
	Warn(keyvals ...interface{})
	Error(keyvals ...interface{})
	Fatal(keyvals ...interface{})
	Panic(keyvals ...interface{})
	Infow(msg string, keyvals ...interface{})
	Debugw(msg string, keyvals ...interface{})
	Warnw(msg string, keyvals ...interface{})
	Errorw(msg string, keyvals ...interface{})
	Fatalw(msg string, keyvals ...interface{})
	Panicw(msg string, keyvals ...interface{})
	With(args ...interface{}) Logger
	Named(s string) Logger
}

Logger is a interface that can log to different levels.

func DefaultLogger

func DefaultLogger() Logger

DefaultLogger is the default logger that only logs at the `DefaultLevel`.

func NewJSONLogger added in v1.4.6

func NewJSONLogger(output zapcore.WriteSyncer, level int) Logger

NewJSONLogger returns a logger that prints statements at the given level as JSON output.

func NewLogger

func NewLogger(output zapcore.WriteSyncer, level int) Logger

NewLogger returns a logger that prints statements at the given level.

Source Files

Jump to

Keyboard shortcuts

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