Documentation
¶
Overview ¶
Package tracelog provides a tracer that acts as a traditional logger.
Index ¶
- Constants
- type LogLevel
- type Logger
- type LoggerFunc
- type TraceLog
- func (tl *TraceLog) TraceBatchEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchEndData)
- func (tl *TraceLog) TraceBatchQuery(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchQueryData)
- func (tl *TraceLog) TraceBatchStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchStartData) context.Context
- func (tl *TraceLog) TraceConnectEnd(ctx context.Context, data pgx.TraceConnectEndData)
- func (tl *TraceLog) TraceConnectStart(ctx context.Context, data pgx.TraceConnectStartData) context.Context
- func (tl *TraceLog) TraceCopyFromEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceCopyFromEndData)
- func (tl *TraceLog) TraceCopyFromStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceCopyFromStartData) context.Context
- func (tl *TraceLog) TraceQueryEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceQueryEndData)
- func (tl *TraceLog) TraceQueryStart(ctx context.Context, conn *pgx.Conn, data pgx.TraceQueryStartData) context.Context
Constants ¶
View Source
const ( LogLevelTrace = LogLevel(6) LogLevelDebug = LogLevel(5) LogLevelInfo = LogLevel(4) LogLevelWarn = LogLevel(3) LogLevelError = LogLevel(2) LogLevelNone = LogLevel(1) )
The values for log levels are chosen such that the zero value means that no log level was specified.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogLevel ¶
type LogLevel int
LogLevel represents the pgx logging level. See LogLevel* constants for possible values.
func LogLevelFromString ¶
LogLevelFromString converts log level string to constant
Valid levels:
trace debug info warn error none
type Logger ¶
type Logger interface { // Log a message at the given level with data key/value pairs. data may be nil. Log(ctx context.Context, level LogLevel, msg string, data map[string]any) }
Logger is the interface used to get log output from pgx.
type LoggerFunc ¶
LoggerFunc is a wrapper around a function to satisfy the pgx.Logger interface
type TraceLog ¶
TraceLog implements pgx.QueryTracer, pgx.BatchTracer, pgx.ConnectTracer, and pgx.CopyFromTracer. All fields are required.
func (*TraceLog) TraceBatchEnd ¶
func (*TraceLog) TraceBatchQuery ¶
func (*TraceLog) TraceBatchStart ¶
func (*TraceLog) TraceConnectEnd ¶
func (*TraceLog) TraceConnectStart ¶
func (*TraceLog) TraceCopyFromEnd ¶
func (*TraceLog) TraceCopyFromStart ¶
func (*TraceLog) TraceQueryEnd ¶
Click to show internal directories.
Click to hide internal directories.