v2

package module
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(opts ...Option)

func DPanic

func DPanic(v ...interface{})

func DPanicf

func DPanicf(template string, v ...interface{})

func Debug

func Debug(v ...interface{})

func DebugIfError

func DebugIfError(err error)

Logs the error to DEBUG-level if is not nil

func DebugStruct

func DebugStruct(taggedStruct interface{}, prefix string)

Log out a struct line by line to Debug

func Debugf

func Debugf(template string, v ...interface{})

func Error

func Error(v ...interface{})

func ErrorStruct

func ErrorStruct(taggedStruct interface{}, prefix string)

Log out a struct line by line to Error

func Errorf

func Errorf(template string, v ...interface{})

func Fatal

func Fatal(v ...interface{})

func FatalIfError

func FatalIfError(err error)

Logs the error to FATAL-level if is not nil

func FatalIfErrorSecondArg

func FatalIfErrorSecondArg(input interface{}, err error) interface{}

Logs if error received as second argument to FATAL-level (and panicking after) is not nil (first argument is discarded)

func Fatalf

func Fatalf(template string, v ...interface{})

func Info

func Info(v ...interface{})

func InfoIfError

func InfoIfError(err error)

Logs the error to INFO-level if is not nil

func InfoStruct

func InfoStruct(taggedStruct interface{}, prefix string)

Log out a struct line by line to Info

func Infof

func Infof(template string, v ...interface{})

func L

func L() *zap.Logger

func Log

func Log(lvl zapcore.Level, msg string, fields ...zapcore.Field)

func LogByteArrayLineByLine

func LogByteArrayLineByLine(in []byte, f func(string, ...interface{}), prefix ...string)

Logs a byteArray line by line

func LogByteArrayLineByLineToDebug

func LogByteArrayLineByLineToDebug(in []byte, prefix ...string)

Logs a byteArray line by line to Debug

func LogByteArrayLineByLineToError

func LogByteArrayLineByLineToError(in []byte, prefix ...string)

Logs a byteArray line by line to Error

func LogByteArrayLineByLineToInfo

func LogByteArrayLineByLineToInfo(in []byte, prefix ...string)

Logs a byteArray line by line to Info

func LogByteArrayLineByLineToWarn

func LogByteArrayLineByLineToWarn(in []byte, prefix ...string)

Logs a byteArray line by line to Warn

func LogEnvStruct

func LogEnvStruct(envStruct interface{}, prefix string)

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 LogIfError

func LogIfError(err error)

Logs the error to ERROR-level if it is not nil

func LogIfErrorSecondArg

func LogIfErrorSecondArg(input interface{}, err error) interface{}

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

func LogIfErrorToInfoSecondArg(_ interface{}, err error)

Logs if error received as second argument to INFO-level is not nil (first argument is discarded)

func LogJSONStruct

func LogJSONStruct(envStruct interface{}, prefix string)

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 interface{}, 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 Panic

func Panic(v ...interface{})

func PanicIfError

func PanicIfError(err error)

Logs the error to PANIC-level (and panicking after) if is not nil

func PanicIfErrorSecondArg

func PanicIfErrorSecondArg(input interface{}, err error) interface{}

Logs if error received as second argument to PANIC-level (and panicking after) is not nil (first argument is discarded)

func Panicf

func Panicf(template string, v ...interface{})

func S

func S() *zap.SugaredLogger

func SkipOneL

func SkipOneL() *zap.Logger

func SkipOneS

func SkipOneS() *zap.SugaredLogger

func Trace

func Trace(v ...interface{})

func TraceIfError

func TraceIfError(err error)

Logs the error to TRACE-level if is not nil

func TraceStruct

func TraceStruct(taggedStruct interface{}, prefix string)

Log out a struct line by line to Trace

func Tracef

func Tracef(template string, v ...interface{})

func Warn

func Warn(v ...interface{})

func WarnIfError

func WarnIfError(err error)

Logs the error to WARN-level if is not nil

func WarnStruct

func WarnStruct(taggedStruct interface{}, prefix string)

Log out a struct line by line to Warn

func Warnf

func Warnf(template string, v ...interface{})

Types

type DebugWriter

type DebugWriter struct{}

func (DebugWriter) Write

func (DebugWriter) Write(p []byte) (int, error)

type ErrorWriter

type ErrorWriter struct{}

func (ErrorWriter) Write

func (ErrorWriter) Write(p []byte) (int, error)

type FatalWriter

type FatalWriter struct{}

func (FatalWriter) Write

func (FatalWriter) Write(p []byte) (int, error)

type InfoWriter

type InfoWriter struct{}

func (InfoWriter) Write

func (InfoWriter) Write(p []byte) (int, error)

type Logger

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

convenience for passing the logger to third-party libs wip, methods might need to be added

func NewDefaultLogger

func NewDefaultLogger() Logger

func NewLogger

func NewLogger(log *zap.SugaredLogger) Logger

func (Logger) DPanic

func (l Logger) DPanic(v ...interface{})

func (Logger) DPanicf

func (l Logger) DPanicf(template string, v ...interface{})

func (Logger) Debug

func (l Logger) Debug(v ...interface{})

func (Logger) Debugf

func (l Logger) Debugf(template string, v ...interface{})

func (Logger) Error

func (l Logger) Error(v ...interface{})

func (Logger) Errorf

func (l Logger) Errorf(template string, v ...interface{})

func (Logger) Fatal

func (l Logger) Fatal(v ...interface{})

func (Logger) Fatalf

func (l Logger) Fatalf(template string, v ...interface{})

func (Logger) Fatalln

func (l Logger) Fatalln(v ...interface{})

func (Logger) Info

func (l Logger) Info(v ...interface{})

func (Logger) Infof

func (l Logger) Infof(template string, v ...interface{})

func (Logger) Panic

func (l Logger) Panic(v ...interface{})

func (Logger) Panicf

func (l Logger) Panicf(template string, v ...interface{})

func (Logger) Panicln

func (l Logger) Panicln(v ...interface{})

func (Logger) Print

func (l Logger) Print(v ...interface{})

func (Logger) Printf

func (l Logger) Printf(format string, v ...interface{})

func (Logger) Println

func (l Logger) Println(v ...interface{})

func (Logger) Trace

func (l Logger) Trace(v ...interface{})

func (Logger) Tracef

func (l Logger) Tracef(template string, v ...interface{})

func (Logger) Warn

func (l Logger) Warn(v ...interface{})

func (Logger) Warnf

func (l Logger) Warnf(template string, v ...interface{})

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithAdditionalCores

func WithAdditionalCores(cores ...zapcore.Core) Option

func WithCallerFieldWidth

func WithCallerFieldWidth(fieldWidth int) Option

func WithIsDevelopment

func WithIsDevelopment(isDevelopment bool) Option

func WithLogLevel

func WithLogLevel(lvl string) Option

func WithNewlineReplacement added in v2.1.7

func WithNewlineReplacement(newlineReplacement string) Option

func WithRedirectOutput

func WithRedirectOutput(w io.Writer) Option

func WithRenderDummyThread

func WithRenderDummyThread(renderDummyThread bool) Option

func WithStripAdditionalFields

func WithStripAdditionalFields(stripAdditionalFields bool) Option

type PanicWriter

type PanicWriter struct{}

func (PanicWriter) Write

func (PanicWriter) Write(p []byte) (int, error)

type TraceWriter

type TraceWriter struct{}

func (TraceWriter) Write

func (TraceWriter) Write(p []byte) (int, error)

type WarnWriter

type WarnWriter struct{}

func (WarnWriter) Write

func (WarnWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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