Documentation
¶
Index ¶
- Variables
- func Debug(args ...any)
- func Debugf(format string, args ...any)
- func Error(args ...any)
- func Errorf(format string, args ...any)
- func Fatal(args ...any)
- func Fatalf(format string, args ...any)
- func Info(args ...any)
- func Infof(format string, args ...any)
- func NewPulsarLogger() pulsarlog.Logger
- func Panic(args ...any)
- func ReplaceStdLogger(l *Logger)
- func Warn(args ...any)
- func Warnf(format string, args ...any)
- type FilteredLevelWriter
- type Logger
- func (l *Logger) Debug(args ...any)
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(args ...any)
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(args ...any)
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(args ...any)
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Panic(args ...any)
- func (l *Logger) Warn(args ...any)
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) WithCallerSkip(skip int) *Logger
- func (l *Logger) WithError(err error) *Logger
- func (l *Logger) WithField(key string, value any) *Logger
- func (l *Logger) WithFields(args map[string]any) *Logger
- func (l *Logger) WithStacktrace(err error) *Logger
- type PrometheusHook
Constants ¶
This section is empty.
Variables ¶
var NullLogger = &Logger{ underlying: zerolog.Nop(), }
NullLogger is Logger that discards all log lines
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 Error ¶ added in v0.16.2
func Error(args ...any)
Error 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
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 NewPulsarLogger ¶ added in v0.16.2
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!
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
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
FromZerolog returns a new Logger backed by the supplied zerolog.Logger
func WithField ¶ added in v0.16.2
WithField returns a new Logger with the key-value pair added as a new field
func WithFields ¶ added in v0.16.2
WithFields returns a new Logger with all key-value pairs in the map added as new fields
func WithStacktrace ¶
WithStacktrace returns a new Logger with the error and (if available) the stacktrace added as fields
func (*Logger) Fatal ¶ added in v0.16.2
Fatal logs a message at level Fatal and exits the application
func (*Logger) Fatalf ¶ added in v0.16.2
Fatalf logs a formatted message at level Fatal and exits the application
func (*Logger) WithCallerSkip ¶ added in v0.16.2
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
WithError returns a new Logger with the error added as a field
func (*Logger) WithField ¶ added in v0.16.2
WithField returns a new Logger with the key-value pair added as a new field
func (*Logger) WithFields ¶ added in v0.16.2
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
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.