Documentation ¶
Overview ¶
Package logx contains logging extensions.
Package logx contains logging extensions
Index ¶
- type Handler
- type OperationLogger
- type PrefixLogger
- func (p *PrefixLogger) Debug(msg string)
- func (p *PrefixLogger) Debugf(format string, v ...interface{})
- func (p *PrefixLogger) Info(msg string)
- func (p *PrefixLogger) Infof(format string, v ...interface{})
- func (p *PrefixLogger) Warn(msg string)
- func (p *PrefixLogger) Warnf(format string, v ...interface{})
- type ScrubberLogger
- func (sl *ScrubberLogger) Debug(message string)
- func (sl *ScrubberLogger) Debugf(format string, v ...interface{})
- func (sl *ScrubberLogger) Info(message string)
- func (sl *ScrubberLogger) Infof(format string, v ...interface{})
- func (sl *ScrubberLogger) Warn(message string)
- func (sl *ScrubberLogger) Warnf(format string, v ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct { // Emoji is OPTIONAL and indicates whether to enable emojis. Emoji bool // Now is the MANDATORY function to compute the current time. Now func() time.Time // StartTime is MANDATORY and indicates when we started logging. StartTime time.Time // Writer is MANDATORY and is the underlying writer. io.Writer }
Handler implements github.com/apex/log.Handler.
func NewHandlerWithDefaultSettings ¶
func NewHandlerWithDefaultSettings() *Handler
NewHandlerWithDefaultSettings creates a new Handler with default settings.
type OperationLogger ¶ added in v3.19.0
type OperationLogger struct {
// contains filtered or unexported fields
}
OperationLogger keeps state required to log about an in-progress operation as documented by NewOperationLogger.
func NewOperationLogger ¶ added in v3.19.0
func NewOperationLogger(logger logmodel.Logger, format string, v ...any) *OperationLogger
NewOperationLogger creates a new logger that logs about an in-progress operation. If it takes too much time to emit the result of the operation, the code will emit an interim log message mentioning that the operation is currently in progress.
func (*OperationLogger) Stop ¶ added in v3.19.0
func (ol *OperationLogger) Stop(value any)
Stop must be called when the operation is done. The [value] argument is the result of the operation, which may be nil. This method ensures that we log the final result of the now-completed operation.
type PrefixLogger ¶ added in v3.19.0
PrefixLogger is a logger with a prefix.
func (*PrefixLogger) Debug ¶ added in v3.19.0
func (p *PrefixLogger) Debug(msg string)
Debug implements DebugLogger.Debug
func (*PrefixLogger) Debugf ¶ added in v3.19.0
func (p *PrefixLogger) Debugf(format string, v ...interface{})
Debugf implements DebugLogger.Debugf
func (*PrefixLogger) Info ¶ added in v3.19.0
func (p *PrefixLogger) Info(msg string)
Info implements InfoLogger.Info
func (*PrefixLogger) Infof ¶ added in v3.19.0
func (p *PrefixLogger) Infof(format string, v ...interface{})
Infov implements InfoLogger.Infov
func (*PrefixLogger) Warn ¶ added in v3.19.0
func (p *PrefixLogger) Warn(msg string)
Warn implements Logger.Warn
func (*PrefixLogger) Warnf ¶ added in v3.19.0
func (p *PrefixLogger) Warnf(format string, v ...interface{})
Warnf implements Logger.Warnf
type ScrubberLogger ¶ added in v3.19.0
type ScrubberLogger struct { // Logger is the MANDATORY underlying logger to use. Logger logmodel.Logger }
ScrubberLogger is a logmodel.Logger with scrubbing. All messages are scrubbed including the ones that won't be emitted. As such, this logger is less efficient than a logger without scrubbing.
The zero value is invalid; please init all MANDATORY fields.
func (*ScrubberLogger) Debug ¶ added in v3.19.0
func (sl *ScrubberLogger) Debug(message string)
Debug scrubs and emits a debug message.
func (*ScrubberLogger) Debugf ¶ added in v3.19.0
func (sl *ScrubberLogger) Debugf(format string, v ...interface{})
Debugf scrubs, formats, and emits a debug message.
func (*ScrubberLogger) Info ¶ added in v3.19.0
func (sl *ScrubberLogger) Info(message string)
Info scrubs and emits an informational message.
func (*ScrubberLogger) Infof ¶ added in v3.19.0
func (sl *ScrubberLogger) Infof(format string, v ...interface{})
Infof scrubs, formats, and emits an informational message.
func (*ScrubberLogger) Warn ¶ added in v3.19.0
func (sl *ScrubberLogger) Warn(message string)
Warn scrubs and emits a warning message.
func (*ScrubberLogger) Warnf ¶ added in v3.19.0
func (sl *ScrubberLogger) Warnf(format string, v ...interface{})
Warnf scrubs, formats, and emits a warning message.