diff --git a/attachment/attachment.go b/attachment/attachment.go index 1003db4..4df32c7 100644 --- a/attachment/attachment.go +++ b/attachment/attachment.go @@ -19,7 +19,7 @@ import ( "github.com/kovetskiy/mark/v16/confluence" "github.com/kovetskiy/mark/v16/vfs" "github.com/reconquest/karma-go" - "github.com/reconquest/pkg/log" + "github.com/rs/zerolog/log" ) const ( @@ -101,7 +101,7 @@ func ResolveAttachments( } for i, attachment := range creating { - log.Infof(nil, "creating attachment: %q", attachment.Name) + log.Info().Msgf("creating attachment: %q", attachment.Name) info, err := api.CreateAttachment( page.ID, @@ -127,7 +127,7 @@ func ResolveAttachments( } for i, attachment := range updating { - log.Infof(nil, "updating attachment: %q", attachment.Name) + log.Info().Msgf("updating attachment: %q", attachment.Name) info, err := api.UpdateAttachment( page.ID, @@ -153,7 +153,7 @@ func ResolveAttachments( } for i := range existing { - log.Infof(nil, "keeping unmodified attachment: %q", existing[i].Name) + log.Info().Msgf("keeping unmodified attachment: %q", existing[i].Name) } attachments = []Attachment{} @@ -260,7 +260,7 @@ func CompileAttachmentLinks(markdown []byte, attachments []Attachment) []byte { if bytes.Contains(markdown, []byte("attachment://"+replace)) { from := "attachment://" + replace - log.Debugf(nil, "replacing legacy link: %q -> %q", from, to) + log.Debug().Msgf("replacing legacy link: %q -> %q", from, to) markdown = bytes.ReplaceAll( markdown, @@ -274,7 +274,7 @@ func CompileAttachmentLinks(markdown []byte, attachments []Attachment) []byte { if bytes.Contains(markdown, []byte(replace)) { from := replace - log.Debugf(nil, "replacing link: %q -> %q", from, to) + log.Debug().Msgf("replacing link: %q -> %q", from, to) markdown = bytes.ReplaceAll( markdown, @@ -286,7 +286,7 @@ func CompileAttachmentLinks(markdown []byte, attachments []Attachment) []byte { } if !found { - log.Warningf(nil, "unused attachment: %s", replace) + log.Warn().Msgf("unused attachment: %s", replace) } } diff --git a/cmd/mark/main.go b/cmd/mark/main.go index 53c2853..862384e 100644 --- a/cmd/mark/main.go +++ b/cmd/mark/main.go @@ -6,7 +6,7 @@ import ( "os" "github.com/kovetskiy/mark/v16/util" - "github.com/reconquest/pkg/log" + "github.com/rs/zerolog/log" "github.com/urfave/cli/v3" ) @@ -34,6 +34,6 @@ func main() { } if err := cmd.Run(context.TODO(), os.Args); err != nil { - log.Fatal(err) + log.Fatal().Msg(err.Error()) } } diff --git a/confluence/api.go b/confluence/api.go index a518cec..8c5763b 100644 --- a/confluence/api.go +++ b/confluence/api.go @@ -13,9 +13,9 @@ import ( "unicode/utf8" "github.com/kovetskiy/gopencils" - "github.com/kovetskiy/lorg" "github.com/reconquest/karma-go" - "github.com/reconquest/pkg/log" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" ) type User struct { @@ -96,7 +96,7 @@ type tracer struct { } func (tracer *tracer) Printf(format string, args ...interface{}) { - log.Tracef(nil, tracer.prefix+" "+format, args...) + log.Trace().Msgf(tracer.prefix+" "+format, args...) } func NewAPI(baseURL string, username string, password string, insecureSkipVerify bool) *API { @@ -132,7 +132,7 @@ func NewAPI(baseURL string, username string, password string, insecureSkipVerify json := gopencils.Api(baseURL+"/rpc/json-rpc/confluenceservice-v2", auth, httpClient, 3) - if log.GetLevel() == lorg.LevelTrace { + if zerolog.GlobalLevel() == zerolog.TraceLevel { rest.Logger = &tracer{"rest:"} json.Logger = &tracer{"json-rpc:"} } diff --git a/d2/d2.go b/d2/d2.go index dc64683..e480b81 100644 --- a/d2/d2.go +++ b/d2/d2.go @@ -14,7 +14,7 @@ import ( "github.com/chromedp/chromedp" "github.com/kovetskiy/mark/v16/attachment" - "github.com/reconquest/pkg/log" + "github.com/rs/zerolog/log" "oss.terrastruct.com/d2/d2graph" "oss.terrastruct.com/d2/d2layouts/d2dagrelayout" @@ -59,7 +59,7 @@ func ProcessD2(title string, d2Diagram []byte, scale float64) (attachment.Attach return attachment.Attachment{}, err } - log.Debugf(nil, "Rendering: %q", title) + log.Debug().Msgf("Rendering: %q", title) pngBytes, boxModel, err := convertSVGtoPNG(ctx, out, scale) if err != nil { return attachment.Attachment{}, err @@ -73,7 +73,7 @@ func ProcessD2(title string, d2Diagram []byte, scale float64) (attachment.Attach checkSum, err := attachment.GetChecksum(bytes.NewReader(d2Bytes)) - log.Debugf(nil, "Checksum: %q -> %s", title, checkSum) + log.Debug().Msgf("Checksum: %q -> %s", title, checkSum) if err != nil { return attachment.Attachment{}, err diff --git a/go.mod b/go.mod index 53cf3ad..eebb3ad 100644 --- a/go.mod +++ b/go.mod @@ -8,9 +8,8 @@ require ( github.com/chromedp/chromedp v0.15.1 github.com/dreampuf/mermaid.go v0.0.40 github.com/kovetskiy/gopencils v0.0.0-20250404051442-0b776066936a - github.com/kovetskiy/lorg v1.2.1-0.20240830111423-ba4fe8b6f7c4 github.com/reconquest/karma-go v1.5.0 - github.com/reconquest/pkg v1.3.1-0.20240901105413-68c2adbf2b64 + github.com/rs/zerolog v1.35.0 github.com/stefanfritsch/goldmark-admonitions v1.1.1 github.com/stretchr/testify v1.11.1 github.com/urfave/cli-altsrc/v3 v3.1.0 @@ -41,13 +40,13 @@ require ( github.com/google/pprof v0.0.0-20240927180334-d43a67379298 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mazznoer/csscolorparser v0.1.5 // indirect github.com/orisano/pixelmatch v0.0.0-20230914042517-fa304d1dc785 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/reconquest/cog v0.0.0-20240830113510-c7ba12d0beeb // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/zazab/zhash v0.0.0-20221031090444-2b0d50417446 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/image v0.20.0 // indirect golang.org/x/net v0.44.0 // indirect diff --git a/go.sum b/go.sum index 963530e..4238559 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,6 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/kovetskiy/gopencils v0.0.0-20250404051442-0b776066936a h1:OPt6gCghZXQ/WZpT6EhGkA7v+YMAYzcCb8SPQWmsb/8= github.com/kovetskiy/gopencils v0.0.0-20250404051442-0b776066936a/go.mod h1:gRW37oDEg9LzOHApv31YzxKBICcCmPtDogaImsxZ6xc= -github.com/kovetskiy/lorg v1.2.1-0.20240830111423-ba4fe8b6f7c4 h1:2eV8tF1u58dqRJMlFUD/Df26BxcIlGVy71rZHN+aNoI= -github.com/kovetskiy/lorg v1.2.1-0.20240830111423-ba4fe8b6f7c4/go.mod h1:p1RuSvyflTF/G4ubeATGurCRKWkULOrN/4PUAEFRq0s= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -64,6 +62,10 @@ github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80 h1:6Yzfa6GP0rIo/kUL github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mazznoer/csscolorparser v0.1.5 h1:Wr4uNIE+pHWN3TqZn2SGpA2nLRG064gB7WdSfSS5cz4= github.com/mazznoer/csscolorparser v0.1.5/go.mod h1:OQRVvgCyHDCAquR1YWfSwwaDcM0LhnSffGnlbOew/3I= github.com/orisano/pixelmatch v0.0.0-20230914042517-fa304d1dc785 h1:J1//5K/6QF10cZ59zLcVNFGmBfiSrH8Cho/lNrViK9s= @@ -71,17 +73,15 @@ github.com/orisano/pixelmatch v0.0.0-20230914042517-fa304d1dc785/go.mod h1:nZgzb github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 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/reconquest/cog v0.0.0-20240830113510-c7ba12d0beeb h1:hJ1ExqE2lTMgTRmjmSiC2hm+sMXCCjjbyiGo3irbEW8= -github.com/reconquest/cog v0.0.0-20240830113510-c7ba12d0beeb/go.mod h1:n+lvvNLeoQmYVvYTFGCtLvoyD9Wz46RO3yCk6GKyZ/4= github.com/reconquest/karma-go v1.5.0 h1:Chn4LtauwnvKfz13ZbmGNrRLKO1NciExHQSOBOsQqt4= github.com/reconquest/karma-go v1.5.0/go.mod h1:52XRXXa2ec/VNrlCirwasdJfNmjI1O87q098gmqILh0= -github.com/reconquest/pkg v1.3.1-0.20240901105413-68c2adbf2b64 h1:OBNLiZay5PYLmGRXGIMEgWSIgbSjOj8nHZxqwLbSsF4= -github.com/reconquest/pkg v1.3.1-0.20240901105413-68c2adbf2b64/go.mod h1:r1Z1JNh3in9xLWbhv5u7cdox9vvGFjlKp89VI10Jrdo= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rs/zerolog v1.35.0 h1:VD0ykx7HMiMJytqINBsKcbLS+BJ4WYjz+05us+LRTdI= +github.com/rs/zerolog v1.35.0/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw= github.com/stefanfritsch/goldmark-admonitions v1.1.1 h1:SncsICdQrIYYaq02Ta+zyc9gNmMfYqQH2qwLSCJYxA4= github.com/stefanfritsch/goldmark-admonitions v1.1.1/go.mod h1:cOZK5O0gE6eWfpxTdjGUmeONW2IL9j3Zujv3KlZWlLo= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= @@ -95,8 +95,6 @@ github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3i github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.8.2 h1:kEGpgqJXdgbkhcOgBxkC0X0PmoPG1ZyoZ117rDVp4zE= github.com/yuin/goldmark v1.8.2/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= -github.com/zazab/zhash v0.0.0-20221031090444-2b0d50417446 h1:75pcOSsb40+ub185cJI7g5uykl9Uu76rD5ONzK/4s40= -github.com/zazab/zhash v0.0.0-20221031090444-2b0d50417446/go.mod h1:NtepZ8TEXErPsmQDMUoN72f8aIy4+xNinSJ3f1giess= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= diff --git a/includes/templates.go b/includes/templates.go index e005fab..666ae29 100644 --- a/includes/templates.go +++ b/includes/templates.go @@ -12,7 +12,7 @@ import ( "go.yaml.in/yaml/v3" "github.com/reconquest/karma-go" - "github.com/reconquest/pkg/log" + "github.com/rs/zerolog/log" ) //