Skip to content

Commit

Permalink
Migrate to github.com/echocat/slf4g.
Browse files Browse the repository at this point in the history
  • Loading branch information
blaubaer committed Nov 7, 2023
1 parent a2cdb70 commit baab1ce
Show file tree
Hide file tree
Showing 21 changed files with 134 additions and 771 deletions.
19 changes: 10 additions & 9 deletions box.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"github.com/echocat/goxr/box/fs"
"github.com/echocat/goxr/box/packed"
"github.com/echocat/goxr/common"
"github.com/echocat/goxr/log"
"github.com/echocat/goxr/runtime"
"github.com/echocat/slf4g"
"io"
"path/filepath"
sr "runtime"
Expand All @@ -16,7 +16,7 @@ import (
type OnFallbackToFsBoxFunc func(packedBoxCandidateFilename string, bases []string, fsBox Box) error

var (
// This variable could easily set while build time using:
// AllowFallbackToFsBox could easily set while build time using:
// go build -ldflags="-X github.com/echocat/goxr.AllowFallbackToFsBox=false" .
// This is useful in case for behave differently for build versions of you application
AllowFallbackToFsBox = true
Expand Down Expand Up @@ -104,21 +104,22 @@ func resolveCallingDir(skipCallerFrames int) string {
return result
}

//noinspection GoSnakeCaseUsage
func OnFallbackToFsBox_Default(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
// noinspection GoSnakeCaseUsage
var OnFallbackToFsBox_Default = func(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
if AllowFallbackToFsBox {
return OnFallbackToFsBox_Warn(packedBoxCandidateFilename, bases, fsBox)
}
return OnFallbackToFsBox_Fail(packedBoxCandidateFilename, bases, fsBox)
}

//noinspection GoSnakeCaseUsage
func OnFallbackToFsBox_Warn(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
log.Warnf("%s does not contain a packed box version. This could happen in development mode", packedBoxCandidateFilename)
// noinspection GoSnakeCaseUsage
var OnFallbackToFsBox_Warn = func(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
log.With("candidate", packedBoxCandidateFilename).
Warn("Candidate does not contain a packed box version. This could happen in development mode.")
return nil
}

//noinspection GoSnakeCaseUsage
func OnFallbackToFsBox_Fail(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
// noinspection GoSnakeCaseUsage
var OnFallbackToFsBox_Fail = func(packedBoxCandidateFilename string, bases []string, fsBox Box) error {
return common.NewPathError("openBox", packedBoxCandidateFilename, common.ErrDoesNotContainBox)
}
13 changes: 6 additions & 7 deletions common/cli.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package common

import (
"github.com/echocat/goxr/log"
"github.com/echocat/goxr/runtime"
"github.com/echocat/slf4g"
_ "github.com/echocat/slf4g/native"
"github.com/urfave/cli"
"net/http"
_ "net/http/pprof"
Expand Down Expand Up @@ -128,12 +129,10 @@ func NewApp() *cli.App {
func cliXpprofHandler() {
if cliXpprofListen != "" {
go func() {
log.WithField("listenAddress", cliXpprofListen).
Warnf("DO NOT USE IN PRODUCTION!"+
" pprof server was activated for debugging at listen address %s."+
" This functionality is only for debug purposes.",
cliXpprofListen,
)
log.With("listenAddress", cliXpprofListen).
Warnf("DO NOT USE IN PRODUCTION!" +
" pprof server was activated for debugging at listen address." +
" This functionality is only for debug purposes.")
if err := http.ListenAndServe(cliXpprofListen, nil); err != nil {
panic(err)
}
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ module github.com/echocat/goxr

require (
github.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee // performance tests
github.com/echocat/slf4g v1.5.2
github.com/echocat/slf4g/native v1.5.2
github.com/edsrzf/mmap-go v1.1.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/urfave/cli v1.22.14
github.com/valyala/fasthttp v1.50.0
Expand Down
12 changes: 7 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
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/echocat/slf4g v0.0.0/go.mod h1:R4ge09pgerMnd/bJQeKVFm4igVYgJW6CqfUOzT/CA10=
github.com/echocat/slf4g v1.5.2 h1:QBdnMI95Ju9j0VHsZ7IHGFKqrsF1EBN1n9EqWIjM4dw=
github.com/echocat/slf4g v1.5.2/go.mod h1:YvF/d1TcPvT+/xiHStLHPI4xPT1GGeEmPczn2MSljNA=
github.com/echocat/slf4g/native v1.5.2 h1:DFXpybP8d3GcflOngj0H7NymJ+McJanNlQRxWL9yEfA=
github.com/echocat/slf4g/native v1.5.2/go.mod h1:vCZn/wnp0xfdXlm5W1DwJI2SaLBc6NKaAqtNqe1y0VY=
github.com/edsrzf/mmap-go v1.1.0 h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ=
github.com/edsrzf/mmap-go v1.1.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
Expand All @@ -20,12 +25,9 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
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.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
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.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand Down Expand Up @@ -60,11 +62,11 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
Expand Down
44 changes: 0 additions & 44 deletions log/colormode.go

This file was deleted.

81 changes: 0 additions & 81 deletions log/configuration.go

This file was deleted.

42 changes: 0 additions & 42 deletions log/format.go

This file was deleted.

58 changes: 0 additions & 58 deletions log/level.go

This file was deleted.

Loading

0 comments on commit baab1ce

Please sign in to comment.