mirror of
https://gitee.ltd/lxh/logger.git
synced 2025-02-22 20:00:40 +08:00
⬆️升级loki-client包依赖
This commit is contained in:
parent
aff875eb11
commit
a1a701428b
42
go.mod
42
go.mod
@ -1,12 +1,14 @@
|
||||
module gitee.ltd/lxh/logger
|
||||
|
||||
go 1.17
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/bytedance/sonic v1.12.5
|
||||
github.com/caarlos0/env/v6 v6.10.1
|
||||
github.com/go-kit/kit v0.12.0
|
||||
github.com/lixh00/loki-client-go v1.0.1
|
||||
github.com/grafana/loki-client-go v0.0.0-20240913122146-e119d400c3a5
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible
|
||||
github.com/panjf2000/ants/v2 v2.10.0
|
||||
github.com/prometheus/common v0.37.0
|
||||
go.uber.org/zap v1.23.0
|
||||
gorm.io/driver/mysql v1.3.2
|
||||
@ -16,17 +18,20 @@ require (
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.4.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bytedance/sonic v1.12.5 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dennwc/varint v1.0.0 // indirect
|
||||
github.com/go-kit/log v0.2.1 // indirect
|
||||
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
||||
github.com/go-sql-driver/mysql v1.6.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/grafana/loki/pkg/push v0.0.0-20240912152814-63e84b476a9a // indirect
|
||||
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.4 // indirect
|
||||
github.com/jpillora/backoff v1.0.0 // indirect
|
||||
@ -37,25 +42,28 @@ require (
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
|
||||
github.com/panjf2000/ants/v2 v2.10.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/client_golang v1.13.0 // indirect
|
||||
github.com/prometheus/client_model v0.3.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/prometheus/prometheus v1.8.2-0.20201028100903-3245b3267b24 // indirect
|
||||
github.com/prometheus/prometheus v0.35.0 // indirect
|
||||
github.com/stretchr/testify v1.8.2 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
go.uber.org/atomic v1.10.0 // indirect
|
||||
go.uber.org/goleak v1.1.12 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
|
||||
golang.org/x/net v0.1.0 // indirect
|
||||
golang.org/x/oauth2 v0.1.0 // indirect
|
||||
golang.org/x/sync v0.9.0 // indirect
|
||||
golang.org/x/sys v0.1.0 // indirect
|
||||
golang.org/x/text v0.4.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20221018160656-63c7b68cfc55 // indirect
|
||||
google.golang.org/grpc v1.50.1 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
|
||||
golang.org/x/net v0.33.0 // indirect
|
||||
golang.org/x/oauth2 v0.18.0 // indirect
|
||||
golang.org/x/sync v0.10.0 // indirect
|
||||
golang.org/x/sys v0.28.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
|
||||
google.golang.org/grpc v1.64.1 // indirect
|
||||
google.golang.org/protobuf v1.36.5 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
@ -21,3 +21,19 @@ func TestLogger2(t *testing.T) {
|
||||
log.Info("我是测试消息")
|
||||
//time.Sleep(5 * time.Second)
|
||||
}
|
||||
|
||||
func TestLogger3(t *testing.T) {
|
||||
InitLogger(LogConfig{
|
||||
Mode: Dev,
|
||||
LokiEnable: true,
|
||||
FileEnable: false,
|
||||
LokiHost: "",
|
||||
LokiPort: 0,
|
||||
LokiSource: "test-logger",
|
||||
LokiJob: "test-logger",
|
||||
})
|
||||
|
||||
log.Info("这是info日志")
|
||||
log.Debug("这是debug日志")
|
||||
log.Warn("这是warn日志")
|
||||
}
|
||||
|
4
loki.go
4
loki.go
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/bytedance/sonic"
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/lixh00/loki-client-go/loki"
|
||||
"github.com/grafana/loki-client-go/loki"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/prometheus/common/model"
|
||||
"go.uber.org/zap"
|
||||
@ -44,7 +44,7 @@ func initLokiCore() zapcore.Core {
|
||||
func initLokiClient() {
|
||||
// 如果Loki配置错误,返回一个nil
|
||||
if config.LokiHost == "" || config.LokiPort < 1 {
|
||||
panic(errors.New("Loki配置错误"))
|
||||
panic(errors.New("loki配置错误"))
|
||||
}
|
||||
// 初始化配置
|
||||
cfg, _ := loki.NewDefaultConfig(config.getLokiPushURL())
|
||||
|
Loading…
x
Reference in New Issue
Block a user