log

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 7 Imported by: 0

README

log

zap logger wrapper

Documentation

Index

Constants

View Source
const (
	DebugLevel = zapcore.DebugLevel
	InfoLevel  = zapcore.InfoLevel
	WarnLevel  = zapcore.WarnLevel
	ErrorLevel = zapcore.ErrorLevel
	FatalLevel = zapcore.FatalLevel
)

Variables

View Source
var (
	Binary      = zap.Binary
	ByteString  = zap.ByteString
	ByteStrings = zap.ByteStrings
	Bool        = zap.Bool
	Float64     = zap.Float64
	Float32     = zap.Float32
	Int         = zap.Int
	Int64       = zap.Int64
	Int32       = zap.Int32
	Int16       = zap.Int16
	Int8        = zap.Int8
	String      = zap.String
	Uint        = zap.Uint
	Uint64      = zap.Uint64
	Uint32      = zap.Uint32
	Uint16      = zap.Uint16
	Uint8       = zap.Uint8
	Namespace   = zap.Namespace
	Stringer    = zap.Stringer
	Time        = zap.Time
	Duration    = zap.Duration
	Reflect     = zap.Reflect
	Err         = zap.Error
	Any         = zap.Any

	Fields        = zap.Fields
	AddCallerSkip = zap.AddCallerSkip
	WithCaller    = zap.WithCaller
	AddCaller     = zap.AddCaller
)

Functions

func Close

func Close() error

Close does not make any effect as stderr is not buffered and is default destination for logs.

func Debug

func Debug(message string, field ...Field)

func Debugf

func Debugf(format string, args ...interface{})

func Error

func Error(message string, fields ...Field)

func Errorf

func Errorf(format string, args ...interface{})

func Fatal

func Fatal(message string, fields ...Field)

func Fatalf

func Fatalf(format string, args ...interface{})

func Info

func Info(message string, fields ...Field)

func Infof

func Infof(format string, args ...interface{})

func SetLevel

func SetLevel(level Level)

func Warn

func Warn(message string, fields ...Field)

func Warnf

func Warnf(format string, args ...interface{})

Types

type Base

type Base = zap.Logger

Base will get deprecated, it's for compatibility only.

func Unwrap

func Unwrap() *Base

Unwrap will get deprecated, it's for compatibility only.

type Field

type Field = zapcore.Field

type Level

type Level = zapcore.Level

func LevelFromString

func LevelFromString(level string) Level

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})

	Debug(message string, fields ...Field)
	Info(message string, fields ...Field)
	Warn(message string, fields ...Field)
	Error(message string, fields ...Field)
	Fatal(message string, fields ...Field)

	With(options ...Option) Logger
	Unwrap() *Base
}

Logger is an abstraction over various log destinations.

func Global

func Global() Logger

func With

func With(options ...Option) Logger

type Option

type Option = zap.Option

Jump to

Keyboard shortcuts

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