refactor (db): Remove unused gorm formatter (#1738)

pull/1753/head
Jim 5 years ago committed by GitHub
parent 84febd9983
commit 983f7b019c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,11 +3,9 @@ package db
import (
"context"
"database/sql"
stderrors "errors"
"fmt"
"github.com/hashicorp/boundary/internal/errors"
"github.com/hashicorp/boundary/internal/observability/event"
"github.com/hashicorp/go-hclog"
"github.com/jackc/pgconn"
_ "github.com/jackc/pgx/v4"
@ -126,23 +124,6 @@ func Open(dbType DbType, connectionUrl string, opt ...Option) (*DB, error) {
return &DB{db}, nil
}
func GetGormLogFormatter(log hclog.Logger) func(values ...interface{}) (messages []interface{}) {
const op = "db.GetGormLogFormatter"
ctx := context.TODO()
return func(values ...interface{}) (messages []interface{}) {
if len(values) > 2 && values[0].(string) == "log" {
switch values[2].(type) {
case *pgconn.PgError:
if log.IsTrace() {
event.WriteError(ctx, op, stderrors.New("error from database adapter"), event.WithInfo("error", values[2], "location", values[1]))
}
}
return nil
}
return nil
}
}
type gormLogger struct {
logger hclog.Logger
}

Loading…
Cancel
Save