logging

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullLogger = &Logger{
	underlying: zerolog.Nop(),
}

NullLogger is Logger that discards all log lines

View Source
var (
	StdSkipFrames = 4
)

Functions

func Debug added in v0.16.2

func Debug(args ...any)

Debug logs a message at level Debug on the default logger.

func Debugf added in v0.16.2

func Debugf(format string, args ...any)

Debugf logs a message at level Debug on the default logger.

func Error added in v0.16.2

func Error(args ...any)

Error logs a message at level Error on the default logger.

func Errorf added in v0.16.2

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

Errorf logs a message at level Error on the default logger.

func Fatal added in v0.16.2

func Fatal(args ...any)

Fatal logs a message at level Fatal on the default logger then the process will exit with status set to 1.

func Fatalf added in v0.16.2

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

Fatalf logs a message at level Fatal on the default logger then the process will exit with status set to 1.

func Info added in v0.16.2

func Info(args ...any)

Info logs a message at level Info on the default logger.

func Infof added in v0.16.2

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

Infof logs a message at level Info on the default logger.

func NewPulsarLogger added in v0.16.2

func NewPulsarLogger() pulsarlog.Logger

NewPulsarLogger returns a Logger that can be used by the pulsar client

func Panic added in v0.16.2

func Panic(args ...any)

Panic logs a message at level Panic on the default logger.

func ReplaceStdLogger added in v0.16.2

func ReplaceStdLogger(l *Logger)

ReplaceStdLogger Replaces the global logger. This should be called once at app startup!

func Warn added in v0.16.2

func Warn(args ...any)

Warn logs a message at level Warn on the default logger.

func Warnf added in v0.16.2

func Warnf(format string, args ...any)

Warnf logs a message at level Warn on the default logger.

Types

type FilteredLevelWriter added in v0.16.2

type FilteredLevelWriter struct {
	// contains filtered or unexported fields
}

func (*FilteredLevelWriter) Write added in v0.16.2

func (w *FilteredLevelWriter) Write(p []byte) (int, error)

Write writes to the underlying Writer.

func (*FilteredLevelWriter) WriteLevel added in v0.16.2

func (w *FilteredLevelWriter) WriteLevel(level zerolog.Level, p []byte) (int, error)

WriteLevel calls WriteLevel of the underlying Writer only if the level is equal or above the Level.

type Logger added in v0.16.2

type Logger struct {
	// contains filtered or unexported fields
}

Logger wraps a zerolog.Logger so that the rest of the code doesn't depend directly on zerolog

func FromZerolog added in v0.16.2

func FromZerolog(l zerolog.Logger) *Logger

FromZerolog returns a new Logger backed by the supplied zerolog.Logger

func StdLogger added in v0.16.2

func StdLogger() *Logger

StdLogger Returns the default logger

func WithError added in v0.16.2

func WithError(err error) *Logger

WithError returns a new Logger with the error added as a field

func WithField added in v0.16.2

func WithField(key string, value any) *Logger

WithField returns a new Logger with the key-value pair added as a new field

func WithFields added in v0.16.2

func WithFields(args map[string]any) *Logger

WithFields returns a new Logger with all key-value pairs in the map added as new fields

func WithStacktrace

func WithStacktrace(err error) *Logger

WithStacktrace returns a new Logger with the error and (if available) the stacktrace added as fields

func (*Logger) Debug added in v0.16.2

func (l *Logger) Debug(args ...any)

Debug logs a message at level Debug

func (*Logger) Debugf added in v0.16.2

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

Debugf logs a formatted message at level Debug

func (*Logger) Error added in v0.16.2

func (l *Logger) Error(args ...any)

Error logs a message at level Error

func (*Logger) Errorf added in v0.16.2

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

Errorf logs a formatted message at level Error

func (*Logger) Fatal added in v0.16.2

func (l *Logger) Fatal(args ...any)

Fatal logs a message at level Fatal and exits the application

func (*Logger) Fatalf added in v0.16.2

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

Fatalf logs a formatted message at level Fatal and exits the application

func (*Logger) Info added in v0.16.2

func (l *Logger) Info(args ...any)

Info logs a message at level Info

func (*Logger) Infof added in v0.16.2

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

Infof logs a formatted message at level Info

func (*Logger) Panic added in v0.16.2

func (l *Logger) Panic(args ...any)

Panic logs a message at level Panic and panics

func (*Logger) Warn added in v0.16.2

func (l *Logger) Warn(args ...any)

Warn logs a message at level Warn

func (*Logger) Warnf added in v0.16.2

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

Warnf logs a formatted message at level Warn

func (*Logger) WithCallerSkip added in v0.16.2

func (l *Logger) WithCallerSkip(skip int) *Logger

WithCallerSkip returns a new Logger with the number of callers skipped increased by the skip amount. This is needed when building wrappers around the Logger so as to prevent us from always reporting the wrapper code as the caller.

func (*Logger) WithError added in v0.16.2

func (l *Logger) WithError(err error) *Logger

WithError returns a new Logger with the error added as a field

func (*Logger) WithField added in v0.16.2

func (l *Logger) WithField(key string, value any) *Logger

WithField returns a new Logger with the key-value pair added as a new field

func (*Logger) WithFields added in v0.16.2

func (l *Logger) WithFields(args map[string]any) *Logger

WithFields returns a new Logger with all key-value pairs in the map added as new fields

func (*Logger) WithStacktrace added in v0.16.2

func (l *Logger) WithStacktrace(err error) *Logger

WithStacktrace returns a new Logger with the error and (if available) the stacktrace added as fields

type PrometheusHook added in v0.16.2

type PrometheusHook struct {
	// contains filtered or unexported fields
}

PrometheusHook implements zerolog.Hook

func NewPrometheusHook added in v0.16.2

func NewPrometheusHook() *PrometheusHook

NewPrometheusHook creates and registers Prometheus counters for each log level.

func (*PrometheusHook) Run added in v0.16.2

func (h *PrometheusHook) Run(_ *zerolog.Event, level zerolog.Level, _ string)

Jump to

Keyboard shortcuts

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