(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchEndData)
| 222 | } |
| 223 | |
| 224 | func (tl *TraceLog) TraceBatchEnd(ctx context.Context, conn *pgx.Conn, data pgx.TraceBatchEndData) { |
| 225 | tl.ensureConfig() |
| 226 | queryData := ctx.Value(tracelogBatchCtxKey).(*traceBatchData) |
| 227 | |
| 228 | endTime := time.Now() |
| 229 | interval := endTime.Sub(queryData.startTime) |
| 230 | |
| 231 | if data.Err != nil { |
| 232 | if tl.shouldLog(LogLevelError) { |
| 233 | tl.log(ctx, conn, LogLevelError, "BatchClose", map[string]any{"err": data.Err, tl.Config.TimeKey: interval}) |
| 234 | } |
| 235 | return |
| 236 | } |
| 237 | |
| 238 | if tl.shouldLog(LogLevelInfo) { |
| 239 | tl.log(ctx, conn, LogLevelInfo, "BatchClose", map[string]any{tl.Config.TimeKey: interval}) |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | type traceCopyFromData struct { |
| 244 | startTime time.Time |
nothing calls this directly
no test coverage detected