Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogEntryVars ¶
type LogEntryVars struct {
Timestamp time.Time
Query string
Operation string
Duration time.Duration
Error error
}
LogEntryVars variables made available t otemplate
type Option ¶ added in v0.1.2
type Option func(hook *QueryHook)
func FromEnv ¶ added in v0.1.2
FromEnv configures the hook using the environment variable value. For example, WithEnv("BUNDEBUG"):
- BUNDEBUG=0 - disables the hook.
- BUNDEBUG=1 - enables the hook.
- BUNDEBUG=2 - enables the hook and verbose mode.
func WithEnabled ¶ added in v0.1.2
WithEnabled enables/disables this hook
func WithQueryHookOptions ¶ added in v0.1.2
func WithQueryHookOptions(opts QueryHookOptions) Option
WithQueryHookOptions allows setting the initial logging options for logrus
func WithVerbose ¶ added in v0.1.2
WithVerbose configures the hook to log all queries (by default, only failed queries are logged)
type QueryHook ¶
type QueryHook struct {
// contains filtered or unexported fields
}
QueryHook wraps query hook
func NewQueryHook ¶
NewQueryHook returns new instance
func (*QueryHook) AfterQuery ¶
func (h *QueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent)
AfterQuery convert a bun QueryEvent into a logrus message
func (*QueryHook) BeforeQuery ¶
BeforeQuery does nothing tbh
Click to show internal directories.
Click to hide internal directories.