Refactor link repository and improve logging
This commit is contained in:
parent
ddaf0dcbfc
commit
458ae28901
7 changed files with 63 additions and 19 deletions
15
database/util.go
Normal file
15
database/util.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package database
|
||||
|
||||
import (
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func LogPoolState(pool *pgxpool.Pool, message string) {
|
||||
stat := pool.Stat()
|
||||
log.Info().
|
||||
Int32("acquired_conns", stat.AcquiredConns()).
|
||||
Int32("idle_conns", stat.IdleConns()).
|
||||
Int32("total_conns", stat.TotalConns()).
|
||||
Msg(message)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue