Skip to content

Commit

Permalink
chore: Format with goimports
Browse files Browse the repository at this point in the history
  • Loading branch information
laynax committed Oct 12, 2022
1 parent a691bda commit 1c933b4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions pkg/interceptors/database_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"

grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
"gorm.io/gorm"

sdkdatabasecontext "github.com/scribd/go-sdk/pkg/context/database"
sdkloggercontext "github.com/scribd/go-sdk/pkg/context/logger"
sdklogger "github.com/scribd/go-sdk/pkg/logger"
"google.golang.org/grpc"
"gorm.io/gorm"
)

// DatabaseLoggingUnaryServerInterceptor returns a unary server interceptor.
Expand Down
8 changes: 4 additions & 4 deletions pkg/interceptors/database_logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import (
"path"
"testing"

sdktesting "github.com/scribd/go-sdk/pkg/testing"
"github.com/scribd/go-sdk/pkg/logger"
"github.com/scribd/go-sdk/pkg/testing/testproto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
Expand All @@ -21,6 +18,10 @@ import (
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer"
"gorm.io/driver/sqlite"
"gorm.io/gorm"

"github.com/scribd/go-sdk/pkg/logger"
sdktesting "github.com/scribd/go-sdk/pkg/testing"
"github.com/scribd/go-sdk/pkg/testing/testproto"
)

type TestRecord struct {
Expand Down Expand Up @@ -194,7 +195,6 @@ func checkGormLoggerFields(t *testing.T, fields map[string]interface{}) {
assert.True(t, ok, "%s not found in log fields", logger.GormTraceFieldKey)
assert.NotEmpty(t, dbFields)


assert.NotEmpty(t, dbFields["elapsed seconds"])
assert.NotEmpty(t, dbFields["affected rows"])
assert.NotEmpty(t, dbFields["sql"])
Expand Down
2 changes: 1 addition & 1 deletion pkg/logger/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (g gormLogger) Trace(ctx context.Context, begin time.Time, fc func() (strin
tracingLogger := g.logger.WithFields(Fields{
GormTraceFieldKey: Fields{
"elapsed seconds": time.Since(begin).Seconds(),
"affected rows": rows,
"affected rows": rows,
"sql": sql,
},
})
Expand Down
1 change: 0 additions & 1 deletion pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package logger

import (

"github.com/sirupsen/logrus"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/middleware/database_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package middleware
import (
"net/http"

"gorm.io/gorm"

sdkdatabasecontext "github.com/scribd/go-sdk/pkg/context/database"
sdkloggercontext "github.com/scribd/go-sdk/pkg/context/logger"
sdklogger "github.com/scribd/go-sdk/pkg/logger"
"gorm.io/gorm"
)

// DatabaseLoggingMiddleware wraps an instantiated sdk.Logger that will be injected
Expand Down

0 comments on commit 1c933b4

Please sign in to comment.