mirror of https://github.com/jackc/pgx.git
Use LogLevel type consistently
parent
4ed4e0122d
commit
d287776d97
8
conn.go
8
conn.go
|
@ -43,7 +43,7 @@ func init() {
|
||||||
type ConnConfig struct {
|
type ConnConfig struct {
|
||||||
pgconn.Config
|
pgconn.Config
|
||||||
Logger Logger
|
Logger Logger
|
||||||
LogLevel int
|
LogLevel LogLevel
|
||||||
CustomConnInfo func(*Conn) (*pgtype.ConnInfo, error) // Callback function to implement connection strategies for different backends. crate, pgbouncer, pgpool, etc.
|
CustomConnInfo func(*Conn) (*pgtype.ConnInfo, error) // Callback function to implement connection strategies for different backends. crate, pgbouncer, pgpool, etc.
|
||||||
CustomCancel func(*Conn) error // Callback function used to override cancellation behavior
|
CustomCancel func(*Conn) error // Callback function used to override cancellation behavior
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ type Conn struct {
|
||||||
preparedStatements map[string]*PreparedStatement
|
preparedStatements map[string]*PreparedStatement
|
||||||
channels map[string]struct{}
|
channels map[string]struct{}
|
||||||
logger Logger
|
logger Logger
|
||||||
logLevel int
|
logLevel LogLevel
|
||||||
fp *fastpath
|
fp *fastpath
|
||||||
poolResetCount int
|
poolResetCount int
|
||||||
preallocatedRows []Rows
|
preallocatedRows []Rows
|
||||||
|
@ -718,7 +718,7 @@ func (c *Conn) unlock() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Conn) shouldLog(lvl int) bool {
|
func (c *Conn) shouldLog(lvl LogLevel) bool {
|
||||||
return c.logger != nil && c.logLevel >= lvl
|
return c.logger != nil && c.logLevel >= lvl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,7 +742,7 @@ func (c *Conn) SetLogger(logger Logger) Logger {
|
||||||
|
|
||||||
// SetLogLevel replaces the current log level and returns the previous log
|
// SetLogLevel replaces the current log level and returns the previous log
|
||||||
// level.
|
// level.
|
||||||
func (c *Conn) SetLogLevel(lvl int) (int, error) {
|
func (c *Conn) SetLogLevel(lvl LogLevel) (LogLevel, error) {
|
||||||
oldLvl := c.logLevel
|
oldLvl := c.logLevel
|
||||||
|
|
||||||
if lvl < LogLevelNone || lvl > LogLevelTrace {
|
if lvl < LogLevelNone || lvl > LogLevelTrace {
|
||||||
|
|
|
@ -28,7 +28,7 @@ type ConnPool struct {
|
||||||
resetCount int
|
resetCount int
|
||||||
afterConnect func(*Conn) error
|
afterConnect func(*Conn) error
|
||||||
logger Logger
|
logger Logger
|
||||||
logLevel int
|
logLevel LogLevel
|
||||||
closed bool
|
closed bool
|
||||||
preparedStatements map[string]*PreparedStatement
|
preparedStatements map[string]*PreparedStatement
|
||||||
acquireTimeout time.Duration
|
acquireTimeout time.Duration
|
||||||
|
|
Loading…
Reference in New Issue