Skip to content

log improvement #54

@pobearm

Description

@pobearm
// Logger represents a logging collector. You can pass a logging collector to
// gosql.SetLogger(myCollector) to make it collect QueryStatus messages
// after executing a query.
type Logger interface {
	Printf(format string, v ...interface{})
}
  1. I use db.WithContext(ctx), set my [trace id] to ctx .
  2. When we print a sql log, i can not get the [trace id] in ctx, so this log cannot be concatenated with other logs through [trace id].

Maybe we shoud change this interface to:

type Logger interface {
	Printf(ctx context.Context, format string, v ...interface{})
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions