18 lines
518 B
Go
18 lines
518 B
Go
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}
|
|
}
|