Documentation ¶
Index ¶
- func WithBuildInfo(logger Interface)
- type Interface
- type LogDisplayType
- type LogLevel
- type SlogLogger
- func (l *SlogLogger) Debug(msg string, args ...any)
- func (l *SlogLogger) Error(msg string, args ...any)
- func (l *SlogLogger) Fatal(msg string, args ...any)
- func (l *SlogLogger) Info(msg string, args ...any)
- func (l *SlogLogger) Reset()
- func (l *SlogLogger) Warn(msg string, args ...any)
- func (l *SlogLogger) With(args ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBuildInfo ¶
func WithBuildInfo(logger Interface)
WithBuildInfo is an utility func that attaches the cmd build information - * process id of the caller, * golang version, * args other params
Types ¶
type Interface ¶
type Interface interface { // With attached attributes to eveery log With(args ...any) // Resets the logger to how it was instantiated. Reset() // Debug log a message at DEBUG level Debug(message string, args ...any) // Error log a message at ERROR level Error(message string, args ...any) // Fatal log a message at FATAL level Fatal(message string, args ...any) // Info log a message at INFO level Info(message string, args ...any) // Warn log a message at WARN level Warn(message string, args ...any) }
Interface is a logger interface that ensures different log library can be used and swap with ease.
type LogDisplayType ¶
type LogDisplayType string
const ( DisplayTypeJson LogDisplayType = "json" DisplayTypeText LogDisplayType = "text" )
func (LogDisplayType) IsValid ¶
func (l LogDisplayType) IsValid() bool
func (LogDisplayType) String ¶
func (l LogDisplayType) String() string
type LogLevel ¶
type LogLevel string
type SlogLogger ¶
type SlogLogger struct {
// contains filtered or unexported fields
}
SlogLogger wraps the sirupsen/logrus library in a way that is compatible with our cache interface
func NewSlogLogger ¶
func NewSlogLogger(level LogLevel, logFormatType LogDisplayType, AddSource bool, output io.Writer) *SlogLogger
func (*SlogLogger) Debug ¶
func (l *SlogLogger) Debug(msg string, args ...any)
func (*SlogLogger) Error ¶
func (l *SlogLogger) Error(msg string, args ...any)
func (*SlogLogger) Fatal ¶
func (l *SlogLogger) Fatal(msg string, args ...any)
func (*SlogLogger) Info ¶
func (l *SlogLogger) Info(msg string, args ...any)
func (*SlogLogger) Reset ¶
func (l *SlogLogger) Reset()
func (*SlogLogger) Warn ¶
func (l *SlogLogger) Warn(msg string, args ...any)
func (*SlogLogger) With ¶
func (l *SlogLogger) With(args ...any)
Click to show internal directories.
Click to hide internal directories.