Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscardLogger ¶
type DiscardLogger struct{}
func (*DiscardLogger) Debug ¶
func (*DiscardLogger) Debug(string, ...any)
func (*DiscardLogger) Error ¶
func (*DiscardLogger) Error(string, ...any)
func (*DiscardLogger) Info ¶
func (*DiscardLogger) Info(string, ...any)
func (*DiscardLogger) Warn ¶
func (*DiscardLogger) Warn(string, ...any)
func (*DiscardLogger) With ¶
func (dl *DiscardLogger) With(...any) Logger
func (*DiscardLogger) WithComponent ¶
func (dl *DiscardLogger) WithComponent(string) Logger
type Logger ¶
type Logger interface { PlainLogger With(args ...any) Logger WithComponent(string) Logger }
func WrapPlainLogger ¶
func WrapPlainLogger[T PlainLogger](logger T) Logger
WrapPlainLogger wraps a logger which implements at least PlainLogger with extra methods needed to implement Logger. If the logger provides a method, it will be used instead of the wrapper's.
It is generically typed to allow calling Logger-like methods on the wrapped logger which return T instead of the interface, which wouldn't work due to Go's type system:
if impl, ok := logger.(interface{ WithComponent(string) T }); ok { return WrapPlainLogger(impl.WithComponent(component)) } else if impl, ok := logger.(interface{ WithComponent(string) PlainLogger }); ok { return impl.WithComponent(component) }
Click to show internal directories.
Click to hide internal directories.