Documentation
¶
Index ¶
- Constants
- func SeverityToLevel(s string) (slog.Level, error)
- type Logger
- type StdLogger
- type StructuredLogger
- func (sl *StructuredLogger) Debug(msg string, keysAndValues ...interface{})
- func (sl *StructuredLogger) Error(msg string, keysAndValues ...interface{})
- func (sl *StructuredLogger) Info(msg string, keysAndValues ...interface{})
- func (sl *StructuredLogger) Warn(msg string, keysAndValues ...interface{})
- type ValueTextHandler
Constants ¶
View Source
const ( Debug = "DEBUG" Info = "INFO" Warn = "WARN" Error = "ERROR" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger interface {
// Debug is for reporting additional information about internal operations.
Debug(format string, args ...interface{})
// Info is for reporting informational messages.
Info(format string, args ...interface{})
// Warn is for reporting warning messages.
Warn(format string, args ...interface{})
// Error is for reporting errors.
Error(format string, args ...interface{})
}
Logger is the interface used throughout the project for logging.
func NewStdLogger ¶
NewStdLogger create a Logger that uses out and err for informational and error messages.
type StdLogger ¶
type StdLogger struct {
// contains filtered or unexported fields
}
StdLogger is the standard logger
type StructuredLogger ¶
type StructuredLogger struct {
// contains filtered or unexported fields
}
func (*StructuredLogger) Debug ¶
func (sl *StructuredLogger) Debug(msg string, keysAndValues ...interface{})
Debug logs debug messages
func (*StructuredLogger) Error ¶
func (sl *StructuredLogger) Error(msg string, keysAndValues ...interface{})
Error logs error messages
func (*StructuredLogger) Info ¶
func (sl *StructuredLogger) Info(msg string, keysAndValues ...interface{})
Info logs info messages
func (*StructuredLogger) Warn ¶
func (sl *StructuredLogger) Warn(msg string, keysAndValues ...interface{})
Warn logs warning messages
type ValueTextHandler ¶
type ValueTextHandler struct {
// contains filtered or unexported fields
}
ValueTextHandler is a [Handler] that writes Records to an io.Writer with values separated by spaces.
func NewValueTextHandler ¶
func NewValueTextHandler(out io.Writer, opts *slog.HandlerOptions) *ValueTextHandler
NewValueTextHandler creates a ValueTextHandler that writes to out, using the given options.
func (*ValueTextHandler) Handle ¶
Handle formats its argument [Record] as a single line of space-separated values. Example output format: 2024-11-12T15:08:11.451377-08:00 INFO "Initalized 0 sources.\n"
Click to show internal directories.
Click to hide internal directories.