Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextLoggerBuilder ¶ added in v1.6.0
ContextLoggerBuilder produces a Logger bound to a request context.
type Hook ¶
type Hook struct {
*Options
}
Hook is an otsql.Hook that emits an access log entry after every SQL event.
type Level ¶ added in v1.6.0
type Level int
Level is the log level used to dispatch a log entry to one of the Logger methods.
type Logger ¶
type Logger interface {
Debug(message string, args ...any)
Info(message string, args ...any)
Error(message string, args ...any)
WithFields(fields ...any) Logger
}
Logger is the minimal logging interface required by the hook. It is intentionally implementation-agnostic: args are flat key/value tuples (k1, v1, k2, v2, ...).
type Option ¶
type Option func(*Options)
Option configures a Hook.
func WithDefaultLevel ¶
func WithLogger ¶
func WithLogger(builder ContextLoggerBuilder) Option
WithLogger installs a ContextLoggerBuilder together with the default level to use when a method has no explicit override. Both arguments are required: it is impossible to install a logger without choosing a default level.