don't enable default logger by default

This commit is contained in:
Qishuai Liu 2024-07-23 23:33:42 +09:00
parent 0ff888602d
commit 252be5342f
No known key found for this signature in database
1 changed files with 2 additions and 3 deletions

View File

@ -87,9 +87,9 @@ func (d *database) SetLogger(loggerFunc LoggerFunc) {
d.logger = loggerFunc
}
// defaultLogger is sqlingo default logger,
// DefaultLogger is sqlingo default logger,
// which print log to stderr and regard executing time gt 100ms as slow sql.
func defaultLogger(sql string, durationNano int64, isTx bool, retry bool) {
func DefaultLogger(sql string, durationNano int64, isTx bool, retry bool) {
// for finding code position, try once is enough
once.Do(func() {
// $GOPATH/pkg/mod/github.com/lqs/sqlingo@vX.X.X/database.go
@ -173,7 +173,6 @@ func Open(driverName string, dataSourceName string) (db Database, err error) {
}
}
db = Use(driverName, sqlDB)
db.SetLogger(defaultLogger)
return
}