(ctx context.Context, conn *pgx.Conn, data pgx.TraceCopyFromEndData)
| 255 | } |
| 256 | |
| 257 | func (tl *TraceLog) TraceCopyFromEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceCopyFromEndData) { |
| 258 | tl.ensureConfig() |
| 259 | copyFromData := ctx.Value(tracelogCopyFromCtxKey).(*traceCopyFromData) |
| 260 | |
| 261 | endTime := time.Now() |
| 262 | interval := endTime.Sub(copyFromData.startTime) |
| 263 | |
| 264 | if data.Err != nil { |
| 265 | if tl.shouldLog(LogLevelError) { |
| 266 | tl.log(ctx, conn, LogLevelError, "CopyFrom", map[string]any{"tableName": copyFromData.TableName, "columnNames": copyFromData.ColumnNames, "err": data.Err, tl.Config.TimeKey: interval}) |
| 267 | } |
| 268 | return |
| 269 | } |
| 270 | |
| 271 | if tl.shouldLog(LogLevelInfo) { |
| 272 | tl.log(ctx, conn, LogLevelInfo, "CopyFrom", map[string]any{"tableName": copyFromData.TableName, "columnNames": copyFromData.ColumnNames, "err": data.Err, tl.Config.TimeKey: interval, "rowCount": data.CommandTag.RowsAffected()}) |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | type traceConnectData struct { |
| 277 | startTime time.Time |
nothing calls this directly
no test coverage detected