diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c3d1a1..3a46b4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,10 +9,10 @@ on: jobs: test: name: Run Tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 strategy: matrix: - go: [ '1.22.x', '1.21.x' ] + go: [ '1.24.x', '1.23.x' ] steps: - name: Install Go ${{ matrix.go }} diff --git a/go.mod b/go.mod index 10171e4..95efba2 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,18 @@ module github.com/upfluence/log -go 1.22 +go 1.24 require ( github.com/sirupsen/logrus v1.6.0 - github.com/stretchr/testify v1.8.1 - github.com/upfluence/errors v0.2.11 + github.com/stretchr/testify v1.11.1 + github.com/upfluence/errors v0.2.19 + github.com/upfluence/pkg v1.14.0 ) require ( - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.4.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + golang.org/x/sys v0.27.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index b49443f..db8039d 100644 --- a/go.sum +++ b/go.sum @@ -1,27 +1,24 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/upfluence/errors v0.2.11 h1:v0siQatgm/ovihotNy++k2AXYk136VLVi4cdxAIFo1s= -github.com/upfluence/errors v0.2.11/go.mod h1:XmrnFoB1O343aOni1tqU1wZNQuRhWNDHXa/cqnFzDzE= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/upfluence/errors v0.2.19 h1:kaFGvVi7dHnUxuGvZ6zsW6lfDebC7sKlD11O9JPhoNk= +github.com/upfluence/errors v0.2.19/go.mod h1:KWq2aU5NtEtuqkw1h0J5LfCUHi58cBnE2ipz2SlY4ig= +github.com/upfluence/pkg v1.14.0 h1:7mzRGOL2mC6wsygts03pefCZB+5qMpmn24l41eZnEBw= +github.com/upfluence/pkg v1.14.0/go.mod h1:Dmz2/YfHzxE+EZPhbulsoeig21sIY80XqTPmT3rjqUg= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sink/error_logger/sink.go b/sink/error_logger/sink.go index 5e4a308..3c1a858 100644 --- a/sink/error_logger/sink.go +++ b/sink/error_logger/sink.go @@ -7,6 +7,7 @@ import ( "github.com/upfluence/errors/reporter" "github.com/upfluence/log/record" "github.com/upfluence/log/sink" + "github.com/upfluence/pkg/pointers" ) type Sink struct { @@ -55,7 +56,14 @@ func (s *Sink) Log(r record.Record) error { } for _, err := range errs { - s.r.Report(err, reporter.ReportOptions{Tags: tags, Depth: s.df.fetch()}) + s.r.Report( + err, + reporter.ReportOptions{ + Tags: tags, + Depth: s.df.fetch(), + ReportedLevel: pointers.Ptr(r.Level()), + }, + ) } return nil diff --git a/sink/error_logger/sink_test.go b/sink/error_logger/sink_test.go index 920046a..4021829 100644 --- a/sink/error_logger/sink_test.go +++ b/sink/error_logger/sink_test.go @@ -8,6 +8,8 @@ import ( "github.com/upfluence/errors/reporter" "github.com/upfluence/log" "github.com/upfluence/log/logtest" + "github.com/upfluence/log/record" + "github.com/upfluence/pkg/pointers" ) type report struct { @@ -35,7 +37,7 @@ func TestSink(t *testing.T) { reports: []report{ { err: errors.New("default msg"), - opts: reporter.ReportOptions{Depth: 2, Tags: map[string]interface{}{}}, + opts: reporter.ReportOptions{Depth: 2, Tags: map[string]any{}, ReportedLevel: pointers.Ptr(record.Error)}, }, }, }, @@ -44,7 +46,7 @@ func TestSink(t *testing.T) { reports: []report{ { err: errors.New("err1"), - opts: reporter.ReportOptions{Depth: 2, Tags: map[string]interface{}{}}, + opts: reporter.ReportOptions{Depth: 2, Tags: map[string]any{}, ReportedLevel: pointers.Ptr(record.Error)}, }, }, }, @@ -57,8 +59,9 @@ func TestSink(t *testing.T) { { err: errors.New("err1"), opts: reporter.ReportOptions{ - Depth: 2, - Tags: map[string]interface{}{"foo": "bar"}, + Depth: 2, + Tags: map[string]any{"foo": "bar"}, + ReportedLevel: pointers.Ptr(record.Error), }, }, }, @@ -70,11 +73,11 @@ func TestSink(t *testing.T) { reports: []report{ { err: errors.New("err1"), - opts: reporter.ReportOptions{Depth: 2, Tags: map[string]interface{}{}}, + opts: reporter.ReportOptions{Depth: 2, Tags: map[string]any{}, ReportedLevel: pointers.Ptr(record.Error)}, }, { err: errors.New("err2"), - opts: reporter.ReportOptions{Depth: 2, Tags: map[string]interface{}{}}, + opts: reporter.ReportOptions{Depth: 2, Tags: map[string]any{}, ReportedLevel: pointers.Ptr(record.Error)}, }, }, },