Skip to content

A query hook for uptrace/bun that logs with uber-go/zap.

Notifications You must be signed in to change notification settings

AlexLast/bunzap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bunzap

A query hook for uptrace/bun that logs with uber-go/zap.

$ go get github.com/alexlast/bunzap

All errors will be logged at error level with the hook enabled, everything else will be logged as debug. If SlowDuration is defined, only operations taking longer than the defined duration will be logged.

Usage

db := bun.NewDB()
logger, err := zap.NewProduction()
db.AddQueryHook(bunzap.NewQueryHook(bunzap.QueryHookOptions{
    Logger:       logger,
    SlowDuration: 200 * time.Millisecond, // Omit to log all operations as debug
}))

About

A query hook for uptrace/bun that logs with uber-go/zap.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages