Documentation
¶
Index ¶
- func Configure(o ...Option)
- func DPanic(v ...any)
- func DPanicf(template string, v ...any)
- func Debug(v ...any)
- func DebugIfError(err error)
- func DebugStruct(taggedStruct any, prefix string)
- func Debugf(template string, v ...any)
- func Debugw(msg string, keysAndValues ...any)
- func Dpanicw(msg string, keysAndValues ...any)
- func Error(v ...any)
- func ErrorStruct(taggedStruct any, prefix string)
- func Errorf(template string, v ...any)
- func Errorw(msg string, keysAndValues ...any)
- func Fatal(v ...any)
- func FatalIfError(err error)
- func FatalIfErrorSecondArg(input any, err error) any
- func Fatalf(template string, v ...any)
- func Fatalw(msg string, keysAndValues ...any)
- func Info(v ...any)
- func InfoIfError(err error)
- func InfoStruct(taggedStruct any, prefix string)
- func Infof(template string, v ...any)
- func Infofw(msg string, keysAndValues ...any)
- func L() *zap.Logger
- func Log(lvl zapcore.Level, args ...any)
- func LogByteArrayLineByLine(in []byte, f func(string, ...any), prefix ...string)
- func LogByteArrayLineByLineToDebug(in []byte, prefix ...string)
- func LogByteArrayLineByLineToError(in []byte, prefix ...string)
- func LogByteArrayLineByLineToInfo(in []byte, prefix ...string)
- func LogByteArrayLineByLineToWarn(in []byte, prefix ...string)
- func LogEnvStruct(envStruct any, prefix string)
- func LogIfError(err error)
- func LogIfErrorSecondArg(input any, err error) any
- func LogIfErrorToInfo(err error)
- func LogIfErrorToInfoSecondArg(_ any, err error)
- func LogJSONStruct(envStruct any, prefix string)
- func LogTaggedStructWithMaskingAndWarning(taggedStruct any, tag string, maskTag string, warnTag string, prefix string, ...)
- func Logf(lvl zapcore.Level, template string, args ...any)
- func Logw(lvl zapcore.Level, msg string, keysAndValues ...any)
- func Panic(v ...any)
- func PanicIfError(err error)
- func PanicIfErrorSecondArg(input any, err error) any
- func Panicf(template string, v ...any)
- func Panicw(msg string, keysAndValues ...any)
- func S() *zap.SugaredLogger
- func SkipOneL() *zap.Logger
- func SkipOneS() *zap.SugaredLogger
- func Warn(v ...any)
- func WarnIfError(err error)
- func WarnStruct(taggedStruct any, prefix string)
- func Warnf(template string, v ...any)
- func Warnw(msg string, keysAndValues ...any)
- func With(args ...any) *zap.SugaredLogger
- type DebugWriter
- type ErrorWriter
- type FatalWriter
- type InfoWriter
- type Logger
- type Option
- func WithAdditionalCores(cores ...zapcore.Core) Option
- func WithBaseFields(fields ...zapcore.Field) Option
- func WithCallerFieldWidth(fieldWidth int) Option
- func WithLogLevel(lvl string) Option
- func WithNewlineReplacement(newlineReplacement string) Option
- func WithRedirectOutput(w io.Writer) Option
- func WithStripAdditionalFields(stripAdditionalFields bool) Option
- type PanicWriter
- type WarnWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugStruct ¶
Log out a struct line by line to Debug
func ErrorStruct ¶
Log out a struct line by line to Error
func FatalIfErrorSecondArg ¶
Logs if error received as second argument to FATAL-level (and panicking after) is not nil (first argument is discarded)
func InfoStruct ¶
Log out a struct line by line to Info
func LogByteArrayLineByLine ¶
Logs a byteArray line by line
func LogByteArrayLineByLineToDebug ¶
Logs a byteArray line by line to Debug
func LogByteArrayLineByLineToError ¶
Logs a byteArray line by line to Error
func LogByteArrayLineByLineToInfo ¶
Logs a byteArray line by line to Info
func LogByteArrayLineByLineToWarn ¶
Logs a byteArray line by line to Warn
func LogEnvStruct ¶
Helper function to log out a struct annotated with "env", "mask" and "warnIf" annotations Good to use with the "github.com/codingconcepts/env" package
func LogIfErrorSecondArg ¶
Logs if error received as second argument to ERROR-level is not nil (first argument is discarded)
func LogIfErrorToInfo ¶
func LogIfErrorToInfo(err error)
Logs the error to INFO-level if it is not nil
func LogIfErrorToInfoSecondArg ¶
Logs if error received as second argument to INFO-level is not nil (first argument is discarded)
func LogJSONStruct ¶
Helper function to log out a struct annotated with "json", "mask" and "warnIf" annotations Good to use with the "encoding/json" package
func LogTaggedStructWithMaskingAndWarning ¶
func LogTaggedStructWithMaskingAndWarning( taggedStruct any, tag string, maskTag string, warnTag string, prefix string, printHeaders bool, logger *zap.SugaredLogger, )
Helper function to log out a struct should only be used if LogEnvStruct() or LogJSONStruct() do not meet your requirements
func PanicIfError ¶
func PanicIfError(err error)
Logs the error to PANIC-level (and panicking after) if is not nil
func PanicIfErrorSecondArg ¶
Logs if error received as second argument to PANIC-level (and panicking after) is not nil (first argument is discarded)
func S ¶
func S() *zap.SugaredLogger
func SkipOneS ¶
func SkipOneS() *zap.SugaredLogger
func WarnStruct ¶
Log out a struct line by line to Warn
func With ¶
func With(args ...any) *zap.SugaredLogger
Types ¶
type DebugWriter ¶
type DebugWriter struct{}
type ErrorWriter ¶
type ErrorWriter struct{}
type FatalWriter ¶
type FatalWriter struct{}
type InfoWriter ¶
type InfoWriter struct{}
type Logger ¶
type Logger interface {
Fatalln(v ...any)
Panicln(v ...any)
Print(v ...any)
Printf(format string, v ...any)
Println(v ...any)
Debug(v ...any)
Debugf(template string, v ...any)
Debugw(msg string, keysAndValues ...any)
Info(v ...any)
Infof(template string, v ...any)
Infow(msg string, keysAndValues ...any)
Warn(v ...any)
Warnf(template string, v ...any)
Warnw(msg string, keysAndValues ...any)
Error(v ...any)
Errorf(template string, v ...any)
Errorw(msg string, keysAndValues ...any)
Fatal(v ...any)
Fatalf(template string, v ...any)
Fatalw(msg string, keysAndValues ...any)
DPanic(v ...any)
DPanicf(template string, v ...any)
DPanicw(msg string, keysAndValues ...any)
Panic(v ...any)
Panicf(template string, v ...any)
Panicw(msg string, keysAndValues ...any)
Log(lvl zapcore.Level, args ...any)
Logf(lvl zapcore.Level, template string, args ...any)
Logw(lvl zapcore.Level, msg string, keysAndValues ...any)
}
convenience for passing the logger to third-party libs
func NewDefaultLogger ¶
func NewDefaultLogger() Logger
func NewDiscardLogger ¶ added in v3.0.5
func NewDiscardLogger() Logger
func NewLogger ¶
func NewLogger(log *zap.SugaredLogger) Logger
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithBaseFields ¶ added in v3.0.8
WithBaseFields attaches persistent fields to the global logger, so they are emitted on every subsequent log entry. They are applied to all cores (the console encoder and any additional cores, e.g. an OTEL core), which makes this the right place to stamp fleet-wide context such as the build version.
Default: nil
func WithNewlineReplacement ¶
Default: ""
func WithStripAdditionalFields ¶
Default: true
type PanicWriter ¶
type PanicWriter struct{}
type WarnWriter ¶
type WarnWriter struct{}