From d287776d9756cbdd64cb4bd6c1433eaaa34f3099 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 23 Mar 2019 11:32:38 -0500 Subject: [PATCH] Use LogLevel type consistently --- conn.go | 8 ++++---- conn_pool.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conn.go b/conn.go index 78716cdf..f5cd9d64 100644 --- a/conn.go +++ b/conn.go @@ -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 { diff --git a/conn_pool.go b/conn_pool.go index d782322c..fc7457ee 100644 --- a/conn_pool.go +++ b/conn_pool.go @@ -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