Documentation
¶
Index ¶
- func Base64(b []byte) base64Enc
- func Eval[V any](f func() V) eval[V]
- func FilterPrintable(s string) (string, bool)
- func FilterPrintableWithMarker(s string) string
- func GetPackageName() (string, error)
- func Identifier(f any) identifier
- func Init(c Config)
- func Keys[K comparable, V any](m map[K]V) fmt.Stringer
- func NewOtelLogger(zapLogger *zap.Logger) otelLogger
- func NewSpecHandler() http.Handler
- func NewTestLogger(tb testing.TB, options ...Option) (Logger, *Recorder)
- func OtelSanitize() bool
- func Prefix(id string) fmt.Stringer
- func Printable(id string) fmt.Stringer
- func RegisterReplacer(s string, replaceWith string)
- func Replacers() map[string]string
- func Since(t time.Time) since
- type Config
- type Logger
- type MockLogger
- func (m *MockLogger) Debug(args ...interface{})
- func (m *MockLogger) Debugf(format string, args ...interface{})
- func (m *MockLogger) DebugfContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) DebugwContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) Error(args ...interface{})
- func (m *MockLogger) Errorf(format string, args ...interface{})
- func (m *MockLogger) ErrorfContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) Errorw(format string, args ...interface{})
- func (m *MockLogger) ErrorwContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) Fatal(args ...interface{})
- func (m *MockLogger) Fatalf(format string, args ...interface{})
- func (m *MockLogger) Info(args ...interface{})
- func (m *MockLogger) Infof(format string, args ...interface{})
- func (m *MockLogger) InfofContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) InfowContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) IsEnabledFor(level zapcore.Level) bool
- func (m *MockLogger) Named(name string) Logger
- func (m *MockLogger) Panic(args ...interface{})
- func (m *MockLogger) Panicf(format string, args ...interface{})
- func (m *MockLogger) PanicfContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) PanicwContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) Warn(args ...interface{})
- func (m *MockLogger) Warnf(format string, args ...interface{})
- func (m *MockLogger) WarnfContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) Warningf(format string, args ...interface{})
- func (m *MockLogger) Warnw(format string, args ...interface{})
- func (m *MockLogger) WarnwContext(_ context.Context, template string, args ...interface{})
- func (m *MockLogger) With(args ...interface{}) Logger
- func (m *MockLogger) Zap() *zap.Logger
- type Option
- type Recorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64 ¶ added in v0.4.1
func Base64(b []byte) base64Enc
Base64 logs lazily a byte array in base64 format
func FilterPrintable ¶ added in v0.6.0
FilterPrintable removes non-printable characters from the passed string. It returns true, if characters have been removed, false otherwise.
func FilterPrintableWithMarker ¶ added in v0.6.0
FilterPrintableWithMarker removes non-printable characters from the passed string. If non-printable characters are found, then a prefix is added to the result.
func GetPackageName ¶ added in v0.4.1
func Identifier ¶ added in v0.4.1
func Identifier(f any) identifier
Identifier logs lazily the identifier of any object
func Keys ¶ added in v0.4.1
func Keys[K comparable, V any](m map[K]V) fmt.Stringer
Keys logs lazily the keys of a map
func NewOtelLogger ¶ added in v0.4.1
func NewSpecHandler ¶
func OtelSanitize ¶ added in v0.6.0
func OtelSanitize() bool
func RegisterReplacer ¶ added in v0.6.0
RegisterReplacer registers a new replacer for the logger name
Types ¶
type Config ¶
type Config struct { // Format is the log record format specifier for the Logging instance. If the // spec is the string "json", log records will be formatted as JSON. Any // other string will be provided to the FormatEncoder. Please see // fabenc.ParseFormat for details on the supported verbs. // // If Format is not provided, a default format that provides basic information will // be used. Format string // LogSpec determines the log levels that are enabled for the logging system. The // spec must be in a format that can be processed by ActivateSpec. // // If LogSpec is not provided, loggers will be enabled at the INFO level. LogSpec string // Writer is the sink for encoded and formatted log records. // // If a Writer is not provided, os.Stderr will be used as the log sink. Writer io.Writer // OtelSanitize when set to true ensures that the strings representing events are first sanitized. // Sanitization means that any non-printable character is removed. // This protects the traces from undesired behaviours like missing tracing. OtelSanitize bool }
type Logger ¶
type Logger interface { With(args ...interface{}) Logger Named(name string) Logger // contains filtered or unexported methods }
Logger provides logging API
func GetLoggerWithReplacements ¶ added in v0.4.1
func MustGetLogger ¶
type MockLogger ¶ added in v0.4.1
type MockLogger struct{}
func (*MockLogger) Debug ¶ added in v0.4.1
func (m *MockLogger) Debug(args ...interface{})
func (*MockLogger) Debugf ¶ added in v0.4.1
func (m *MockLogger) Debugf(format string, args ...interface{})
func (*MockLogger) DebugfContext ¶ added in v0.4.1
func (m *MockLogger) DebugfContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) DebugwContext ¶ added in v0.4.1
func (m *MockLogger) DebugwContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) Error ¶ added in v0.4.1
func (m *MockLogger) Error(args ...interface{})
func (*MockLogger) Errorf ¶ added in v0.4.1
func (m *MockLogger) Errorf(format string, args ...interface{})
func (*MockLogger) ErrorfContext ¶ added in v0.4.1
func (m *MockLogger) ErrorfContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) Errorw ¶ added in v0.4.1
func (m *MockLogger) Errorw(format string, args ...interface{})
func (*MockLogger) ErrorwContext ¶ added in v0.4.1
func (m *MockLogger) ErrorwContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) Fatal ¶ added in v0.4.1
func (m *MockLogger) Fatal(args ...interface{})
func (*MockLogger) Fatalf ¶ added in v0.4.1
func (m *MockLogger) Fatalf(format string, args ...interface{})
func (*MockLogger) Info ¶ added in v0.4.1
func (m *MockLogger) Info(args ...interface{})
func (*MockLogger) Infof ¶ added in v0.4.1
func (m *MockLogger) Infof(format string, args ...interface{})
func (*MockLogger) InfofContext ¶ added in v0.4.1
func (m *MockLogger) InfofContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) InfowContext ¶ added in v0.4.1
func (m *MockLogger) InfowContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) IsEnabledFor ¶ added in v0.4.1
func (m *MockLogger) IsEnabledFor(level zapcore.Level) bool
func (*MockLogger) Named ¶ added in v0.4.1
func (m *MockLogger) Named(name string) Logger
func (*MockLogger) Panic ¶ added in v0.4.1
func (m *MockLogger) Panic(args ...interface{})
func (*MockLogger) Panicf ¶ added in v0.4.1
func (m *MockLogger) Panicf(format string, args ...interface{})
func (*MockLogger) PanicfContext ¶ added in v0.4.1
func (m *MockLogger) PanicfContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) PanicwContext ¶ added in v0.4.1
func (m *MockLogger) PanicwContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) Warn ¶ added in v0.4.1
func (m *MockLogger) Warn(args ...interface{})
func (*MockLogger) Warnf ¶ added in v0.4.1
func (m *MockLogger) Warnf(format string, args ...interface{})
func (*MockLogger) WarnfContext ¶ added in v0.4.1
func (m *MockLogger) WarnfContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) Warningf ¶ added in v0.4.1
func (m *MockLogger) Warningf(format string, args ...interface{})
func (*MockLogger) Warnw ¶ added in v0.4.1
func (m *MockLogger) Warnw(format string, args ...interface{})
func (*MockLogger) WarnwContext ¶ added in v0.4.1
func (m *MockLogger) WarnwContext(_ context.Context, template string, args ...interface{})
func (*MockLogger) With ¶ added in v0.4.1
func (m *MockLogger) With(args ...interface{}) Logger
func (*MockLogger) Zap ¶ added in v0.4.1
func (m *MockLogger) Zap() *zap.Logger
type Recorder ¶
type Recorder = floggingtest.Recorder
Click to show internal directories.
Click to hide internal directories.