2
0

Add context.Context to Logger interface

This allows custom logger adapters to add additional fields to log
messages. For example, a HTTP server may with to log the request ID.

fixes #428
This commit is contained in:
Jack Christensen
2019-08-03 16:16:21 -05:00
parent ab1edc79e0
commit 3028821487
11 changed files with 68 additions and 22 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
package pgx
import (
"context"
"encoding/hex"
"fmt"
@@ -44,7 +45,7 @@ func (ll LogLevel) String() string {
// Logger is the interface used to get logging from pgx internals.
type Logger interface {
// Log a message at the given level with data key/value pairs. data may be nil.
Log(level LogLevel, msg string, data map[string]interface{})
Log(ctx context.Context, level LogLevel, msg string, data map[string]interface{})
}
// LogLevelFromString converts log level string to constant