Skip to content

Commit

Permalink
Replacing go-kit/kit/log with go-kit/log (#4484)
Browse files Browse the repository at this point in the history
* Replacing go-kit/kit/log with go-kit/log

Signed-off-by: Danny Kopping <[email protected]>

* Appeasing the f&^$ing linter

Signed-off-by: Danny Kopping <[email protected]>

* Adding depguard

Cleaning go mod

Signed-off-by: Danny Kopping <[email protected]>

* Updating weaveworks after weaveworks/common#226 was merged

Signed-off-by: Danny Kopping <[email protected]>

* Appeasing the mod checker

Signed-off-by: Danny Kopping <[email protected]>
  • Loading branch information
Danny Kopping authored Oct 15, 2021
1 parent 096cf0c commit cff8324
Show file tree
Hide file tree
Showing 187 changed files with 291 additions and 270 deletions.
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ linters-settings:
goimports:
local-prefixes: github.com/grafana/loki/pkg

depguard:
list-type: blacklist
include-go-root: true
packages-with-error-message:
- github.com/go-kit/kit/log: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"

linters:
enable:
- deadcode
Expand All @@ -67,6 +73,7 @@ linters:
- govet
- unused
- typecheck
- depguard

issues:
exclude:
Expand Down
4 changes: 2 additions & 2 deletions clients/cmd/docker-driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/docker/docker/api/types/plugins/logdriver"
"github.com/docker/docker/daemon/logger"
"github.com/docker/docker/daemon/logger/jsonfilelog"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
protoio "github.com/gogo/protobuf/io"
"github.com/pkg/errors"
"github.com/tonistiigi/fifo"
Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/docker-driver/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"

"github.com/docker/docker/daemon/logger"
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down
10 changes: 5 additions & 5 deletions clients/cmd/docker-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package main
import (
"fmt"
"net/http"
"os"

_ "net/http/pprof"
"os"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/docker/go-plugins-helpers/sdk"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/common/version"
"github.com/weaveworks/common/logging"

"github.com/grafana/loki/pkg/util"
_ "github.com/grafana/loki/pkg/util/build"
)

Expand Down Expand Up @@ -54,7 +54,7 @@ func main() {
func newLogger(lvl logging.Level) log.Logger {
// plugin logs must be stdout to appear.
logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout))
logger = level.NewFilter(logger, lvl.Gokit)
logger = level.NewFilter(logger, util.LogFilter(lvl.String()))
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
logger = log.With(logger, "caller", log.Caller(3))
return logger
Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/fluent-bit/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/go-kit/kit/log"
"github.com/go-kit/log"

"github.com/grafana/loki/clients/pkg/promtail/client"
)
Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/fluent-bit/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/prometheus/client_golang/prometheus"

"github.com/grafana/loki/clients/pkg/promtail/client"
Expand Down
4 changes: 2 additions & 2 deletions clients/cmd/fluent-bit/dque.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"sync"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/joncrlsn/dque"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down
8 changes: 5 additions & 3 deletions clients/cmd/fluent-bit/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"strings"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/go-logfmt/logfmt"
jsoniter "github.com/json-iterator/go"
"github.com/prometheus/common/model"
Expand All @@ -19,6 +19,8 @@ import (
"github.com/grafana/loki/clients/pkg/promtail/api"
"github.com/grafana/loki/clients/pkg/promtail/client"

"github.com/grafana/loki/pkg/util"

"github.com/grafana/loki/pkg/logproto"
)

Expand Down Expand Up @@ -255,7 +257,7 @@ func createLine(records map[string]interface{}, f format) (string, error) {

func newLogger(logLevel logging.Level) log.Logger {
logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
logger = level.NewFilter(logger, logLevel.Gokit)
logger = level.NewFilter(logger, util.LogFilter(logLevel.String()))
logger = log.With(logger, "caller", log.Caller(3))
return logger
}
4 changes: 2 additions & 2 deletions clients/cmd/fluent-bit/out_grafana_loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"C"

"github.com/fluent/fluent-bit-go/output"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/common/version"
"github.com/weaveworks/common/logging"

Expand Down
2 changes: 1 addition & 1 deletion clients/cmd/promtail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"k8s.io/klog"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log/level"
"github.com/grafana/dskit/flagext"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/version"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"regexp"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/extensions.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package stages

import (
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/prometheus/client_golang/prometheus"
)

Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"reflect"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/jmespath/go-jmespath"
json "github.com/json-iterator/go"
"github.com/mitchellh/mapstructure"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"reflect"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/assert"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/logfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strings"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/go-logfmt/logfmt"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/match.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package stages
import (
"github.com/prometheus/prometheus/pkg/labels"

"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/multiline.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"sync"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"reflect"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/prometheus/common/model"
)
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/assert"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"sort"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
json "github.com/json-iterator/go"
"github.com/mitchellh/mapstructure"
"github.com/prometheus/client_golang/prometheus"
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package stages
import (
"sync"

"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"

Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"time"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/assert"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"regexp"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/regex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"text/template"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"time"

"github.com/Masterminds/sprig/v3"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/prometheus/common/model"

Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/assert"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"reflect"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/logentry/stages/tenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log"
"github.com/go-kit/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/assert"
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/logentry/stages/timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"reflect"
"time"

"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
lru "github.com/hashicorp/golang-lru"
"github.com/mitchellh/mapstructure"
"github.com/prometheus/common/model"
Expand Down
Loading

0 comments on commit cff8324

Please sign in to comment.