diff --git a/context/properties.go b/context/properties.go index d4faae56..8403bf85 100644 --- a/context/properties.go +++ b/context/properties.go @@ -228,21 +228,3 @@ func UpdateProperties(ctx Context, props map[string]string) error { defer ctx.ClearCache() return ctx.DB().Exec(query, args...).Error } - -func getLogLevel(level string) int { - if i, err := strconv.Atoi(level); err == nil { - return i - } - switch level { - case "debug": - return 1 - case "trace": - return 2 - case "warn": - return -1 - case "error": - return -2 - default: - return 0 - } -} diff --git a/gorm/logger.go b/gorm/logger.go index 416ab703..67bdb382 100644 --- a/gorm/logger.go +++ b/gorm/logger.go @@ -61,7 +61,6 @@ type Config struct { type SqlLogger struct { Config commons.Logger - skipLevel int } func (l *SqlLogger) WithLogLevel(level any) *SqlLogger { @@ -162,23 +161,3 @@ func (l *SqlLogger) ParamsFilter(ctx context.Context, sql string, params ...inte } return sql, nil } - -type traceRecorder struct { - Logger - BeginAt time.Time - SQL string - RowsAffected int64 - Err error -} - -// New trace recorder -func (l *traceRecorder) New() *traceRecorder { - return &traceRecorder{Logger: l.Logger, BeginAt: time.Now()} -} - -// Trace implement logger interface -func (l *traceRecorder) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) { - l.BeginAt = begin - l.SQL, l.RowsAffected = fc() - l.Err = err -} diff --git a/hack/migrate/main.go b/hack/migrate/main.go index fae62c2a..0cf61fc1 100644 --- a/hack/migrate/main.go +++ b/hack/migrate/main.go @@ -3,13 +3,17 @@ package main import ( "github.com/flanksource/commons/logger" "github.com/flanksource/duty" + "github.com/flanksource/duty/api" + "github.com/spf13/cobra" ) var migrate = &cobra.Command{ Use: "migrate", Run: func(cmd *cobra.Command, args []string) { - if err := duty.Migrate(connection, nil); err != nil { + if err := duty.Migrate(api.Config{ + ConnectionString: connection, + }); err != nil { logger.Fatalf(err.Error()) } }, diff --git a/pkg/kube/labels/selector.go b/pkg/kube/labels/selector.go index 8b3ebf25..16e6e53e 100644 --- a/pkg/kube/labels/selector.go +++ b/pkg/kube/labels/selector.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ - +// nolint package labels import ( diff --git a/pkg/kube/labels/selector_test.go b/pkg/kube/labels/selector_test.go index e700e28e..a1d3dcfe 100644 --- a/pkg/kube/labels/selector_test.go +++ b/pkg/kube/labels/selector_test.go @@ -2,18 +2,19 @@ Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance wginkgo.Ith the License. +you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in wrginkgo.Iting, software +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, -Wginkgo.ItHOUT WARRANTIES OR CONDginkgo.ItIONS OF ANY KIND, eginkgo.Ither express or implied. +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limginkgo.Itations under the License. +limitations under the License. */ +// nolint package labels import ( diff --git a/telemetry/otel.go b/telemetry/otel.go index 8d7d37b8..5512fdf2 100644 --- a/telemetry/otel.go +++ b/telemetry/otel.go @@ -65,9 +65,9 @@ func InitTracer(serviceName, collectorURL string, insecure bool, resourceAttrs . otel.SetTextMapPropagator(propagation.TraceContext{}) return func(ctx context.Context) error { - logger.Infof("Shutting down exporter") - exporter.Shutdown(ctx) - logger.Infof("Shutdown exporter") + logger.Debugf("Shutting down otel exporter") + _ = exporter.Shutdown(ctx) + logger.Debugf("Shutdown complete") return nil } } diff --git a/tests/matcher/fixture.go b/tests/matcher/fixture.go index 4f86b67c..322168b5 100644 --- a/tests/matcher/fixture.go +++ b/tests/matcher/fixture.go @@ -39,7 +39,6 @@ func MatchMap(a map[string]string, jq ...string) gcustom.CustomGomegaMatcher { } for _, _jq := range jq { - expectedJSONb, err = ParseJQ([]byte(expectedJSON), _jq) if err != nil { return false, err @@ -50,7 +49,7 @@ func MatchMap(a map[string]string, jq ...string) gcustom.CustomGomegaMatcher { } } - diff, err := generateDiff(string(expectedJSON), string(actualJSON)) + diff, err := generateDiff(string(actualJSONb), string(expectedJSONb)) if err != nil { return false, err }