Use LogLevel type consistently

pull/483/head
Jack Christensen 2019-03-23 11:32:38 -05:00
parent 4ed4e0122d
commit d287776d97
2 changed files with 5 additions and 5 deletions

View File

@ -43,7 +43,7 @@ func init() {
type ConnConfig struct {
pgconn.Config
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.
CustomCancel func(*Conn) error // Callback function used to override cancellation behavior
@ -69,7 +69,7 @@ type Conn struct {
preparedStatements map[string]*PreparedStatement
channels map[string]struct{}
logger Logger
logLevel int
logLevel LogLevel
fp *fastpath
poolResetCount int
preallocatedRows []Rows
@ -718,7 +718,7 @@ func (c *Conn) unlock() error {
return nil
}
func (c *Conn) shouldLog(lvl int) bool {
func (c *Conn) shouldLog(lvl LogLevel) bool {
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
// level.
func (c *Conn) SetLogLevel(lvl int) (int, error) {
func (c *Conn) SetLogLevel(lvl LogLevel) (LogLevel, error) {
oldLvl := c.logLevel
if lvl < LogLevelNone || lvl > LogLevelTrace {

View File

@ -28,7 +28,7 @@ type ConnPool struct {
resetCount int
afterConnect func(*Conn) error
logger Logger
logLevel int
logLevel LogLevel
closed bool
preparedStatements map[string]*PreparedStatement
acquireTimeout time.Duration