zapl

package
v0.0.0-...-58b8290 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = New(log.DebugLevel, os.Stdout, os.Stderr)

DefaultLogger represents the default Log to use This Log wraps zap under the hood

View Source
var DiscardLogger = New(log.InfoLevel, io.Discard)

DiscardLogger is used not log anything

Functions

func Error

func Error(v ...any)

Error logs to the ERROR level.

func Errorf

func Errorf(format string, v ...any)

Errorf logs to the ERROR level.

func Fatal

func Fatal(v ...any)

Fatal logs to the FATAL level followed by a call to os.Exit(1).

func Fatalf

func Fatalf(format string, v ...any)

Fatalf logs to the FATAL level followed by a call to os.Exit(1).

func Info

func Info(v ...any)

Info logs to INFO level.

func Infof

func Infof(format string, v ...any)

Infof logs to INFO level

func Panic

func Panic(v ...any)

Panic logs to the PANIC level followed by a call to panic().

func Panicf

func Panicf(format string, v ...any)

Panicf logs to the PANIC level followed by a call to panic().

func Warning

func Warning(v ...any)

Warning logs to the WARNING level.

func Warningf

func Warningf(format string, v ...any)

Warningf logs to the WARNING level.

func WithContext

func WithContext(ctx context.Context) log.Logger

WithContext returns the Logger associated with the ctx. This will set the traceid, requestid and spanid in case there are in the context

Types

type Log

type Log struct {
	*zap.Logger
}

Log implements Logger interface with the underlying zap as the underlying logging library

func New

func New(level log.Level, writers ...io.Writer) *Log

New creates an instance of Log

func (*Log) Debug

func (l *Log) Debug(v ...any)

Debug starts a message with debug level

func (*Log) Debugf

func (l *Log) Debugf(format string, v ...any)

Debugf starts a message with debug level

func (*Log) Error

func (l *Log) Error(v ...any)

Error starts a new message with error level.

func (*Log) Errorf

func (l *Log) Errorf(format string, v ...any)

Errorf starts a new message with error level.

func (*Log) Fatal

func (l *Log) Fatal(v ...any)

Fatal starts a new message with fatal level. The os.Exit(1) function is called which terminates the program immediately.

func (*Log) Fatalf

func (l *Log) Fatalf(format string, v ...any)

Fatalf starts a new message with fatal level. The os.Exit(1) function is called which terminates the program immediately.

func (*Log) Info

func (l *Log) Info(v ...any)

Info starts a message with info level

func (*Log) Infof

func (l *Log) Infof(format string, v ...any)

Infof starts a message with info level

func (*Log) LogLevel

func (l *Log) LogLevel() log.Level

LogLevel returns the log level that is used

func (*Log) Panic

func (l *Log) Panic(v ...any)

Panic starts a new message with panic level. The panic() function is called which stops the ordinary flow of a goroutine.

func (*Log) Panicf

func (l *Log) Panicf(format string, v ...any)

Panicf starts a new message with panic level. The panic() function is called which stops the ordinary flow of a goroutine.

func (*Log) Warn

func (l *Log) Warn(v ...any)

Warn starts a new message with warn level

func (*Log) Warnf

func (l *Log) Warnf(format string, v ...any)

Warnf starts a new message with warn level

func (*Log) WithContext

func (l *Log) WithContext(ctx context.Context) log.Logger

WithContext returns the Logger associated with the ctx. This will set the traceid, requestid and spanid in case there are in the context

Jump to

Keyboard shortcuts

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