Route GORM's logger through slog and bound it (closes #178)
All checks were successful
check / check (push) Successful in 2m57s
All checks were successful
check / check (push) Successful in 2m57s
This commit was merged in pull request #182.
This commit is contained in:
17
internal/gormlog/export_test.go
Normal file
17
internal/gormlog/export_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package gormlog
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ExportNewWithSlowThreshold builds a Logger whose slow-statement
|
||||
// threshold is d rather than DefaultSlowThreshold, so a test can pin
|
||||
// which arm of Trace it is exercising instead of racing the clock on a
|
||||
// loaded machine. The threshold is set at construction, like every
|
||||
// other field, so the type's concurrency guarantee still holds.
|
||||
func ExportNewWithSlowThreshold(
|
||||
log *slog.Logger, d time.Duration,
|
||||
) *Logger {
|
||||
return &Logger{log: log, slowThreshold: d}
|
||||
}
|
||||
Reference in New Issue
Block a user