Documentation ¶
Index ¶
Constants ¶
View Source
const ( LogLevelTrace = 6 LogLevelDebug = 5 LogLevelInfo = 4 LogLevelWarn = 3 LogLevelError = 2 LogLevelNone = 1 )
Variables ¶
This section is empty.
Functions ¶
func StringFromLogLevel ¶
Types ¶
type ErrInvalidLogLevel ¶
type ErrInvalidLogLevel struct {
Level any
}
func (ErrInvalidLogLevel) Error ¶
func (e ErrInvalidLogLevel) Error() string
type Logger ¶
type Logger interface { // Log a message at the given level with data key/value pairs. data may be nil. Log(context context.Context, level LogLevel, msg string, data map[string]interface{}) }
Logging interface, heavily inspired by github.com/jackc/pgx's logger. The primary difference is that `LogLevel` is a type alias rather than a newtype. This makes it easier for other libraries to support the interface (in theory), as they don't need to depend on this package directly.
Adapters are provided for pgx and log15.
Click to show internal directories.
Click to hide internal directories.