Use internal log package to avoid breaking programs that have their own global loggers
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
cf8d08574f
commit
6388180768
2
build.go
2
build.go
@ -23,7 +23,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/build"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/osutils"
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/twitchtv/twirp"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/api"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/twitchtv/twirp"
|
||||
"go.elara.ws/logger"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/api"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/repos"
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/repos"
|
||||
)
|
||||
|
2
fix.go
2
fix.go
@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/internal/repos"
|
||||
|
2
info.go
2
info.go
@ -22,7 +22,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/lure/distro"
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/build"
|
||||
"go.elara.ws/lure/internal/cliutils"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
|
||||
"github.com/goreleaser/nfpm/v2"
|
||||
"github.com/goreleaser/nfpm/v2/files"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/distro"
|
||||
"go.elara.ws/lure/internal/cliutils"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/internal/types"
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/internal/pager"
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/types"
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
)
|
||||
|
||||
type Paths struct {
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
|
@ -27,7 +27,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"golang.org/x/exp/slices"
|
||||
"modernc.org/sqlite"
|
||||
|
@ -36,7 +36,7 @@ import (
|
||||
|
||||
"github.com/PuerkitoBio/purell"
|
||||
"github.com/vmihailenco/msgpack/v5"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/dlcache"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
84
internal/log/log.go
Normal file
84
internal/log/log.go
Normal file
@ -0,0 +1,84 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"go.elara.ws/logger"
|
||||
)
|
||||
|
||||
var Logger logger.Logger = logger.NewCLI(os.Stderr)
|
||||
|
||||
// NoPanic prevents the logger from panicking on panic events
|
||||
func NoPanic() {
|
||||
Logger.NoPanic()
|
||||
}
|
||||
|
||||
// NoExit prevents the logger from exiting on fatal events
|
||||
func NoExit() {
|
||||
Logger.NoExit()
|
||||
}
|
||||
|
||||
// SetLevel sets the log level of the logger
|
||||
func SetLevel(l logger.LogLevel) {
|
||||
Logger.SetLevel(l)
|
||||
}
|
||||
|
||||
// Debug creates a new debug event with the given message
|
||||
func Debug(msg string) logger.LogBuilder {
|
||||
return Logger.Debug(msg)
|
||||
}
|
||||
|
||||
// Debugf creates a new debug event with the formatted message
|
||||
func Debugf(format string, v ...any) logger.LogBuilder {
|
||||
return Logger.Debugf(format, v...)
|
||||
}
|
||||
|
||||
// Info creates a new info event with the given message
|
||||
func Info(msg string) logger.LogBuilder {
|
||||
return Logger.Info(msg)
|
||||
}
|
||||
|
||||
// Infof creates a new info event with the formatted message
|
||||
func Infof(format string, v ...any) logger.LogBuilder {
|
||||
return Logger.Infof(format, v...)
|
||||
}
|
||||
|
||||
// Warn creates a new warn event with the given message
|
||||
func Warn(msg string) logger.LogBuilder {
|
||||
return Logger.Warn(msg)
|
||||
}
|
||||
|
||||
// Warnf creates a new warn event with the formatted message
|
||||
func Warnf(format string, v ...any) logger.LogBuilder {
|
||||
return Logger.Warnf(format, v...)
|
||||
}
|
||||
|
||||
// Error creates a new error event with the given message
|
||||
func Error(msg string) logger.LogBuilder {
|
||||
return Logger.Error(msg)
|
||||
}
|
||||
|
||||
// Errorf creates a new error event with the formatted message
|
||||
func Errorf(format string, v ...any) logger.LogBuilder {
|
||||
return Logger.Errorf(format, v...)
|
||||
}
|
||||
|
||||
// Fatal creates a new fatal event with the given message
|
||||
func Fatal(msg string) logger.LogBuilder {
|
||||
return Logger.Fatal(msg)
|
||||
}
|
||||
|
||||
// Fatalf creates a new fatal event with the formatted message
|
||||
func Fatalf(format string, v ...any) logger.LogBuilder {
|
||||
return Logger.Fatalf(format, v...)
|
||||
}
|
||||
|
||||
// Fatal creates a new fatal event with the given message
|
||||
func Panic(msg string) logger.LogBuilder {
|
||||
return Logger.Panic(msg)
|
||||
}
|
||||
|
||||
// Fatalf creates a new fatal event with the formatted message
|
||||
func Panicf(format string, v ...any) logger.LogBuilder {
|
||||
return Logger.Panicf(format, v...)
|
||||
}
|
@ -34,7 +34,7 @@ import (
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
"github.com/go-git/go-git/v5/plumbing/format/diff"
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/distro"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"embed"
|
||||
|
||||
"go.elara.ws/logger"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/translate"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
2
list.go
2
list.go
@ -22,7 +22,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/internal/repos"
|
||||
|
2
main.go
2
main.go
@ -28,9 +28,9 @@ import (
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/logger"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/translations"
|
||||
"go.elara.ws/lure/manager"
|
||||
)
|
||||
|
2
repo.go
2
repo.go
@ -24,7 +24,7 @@ import (
|
||||
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/internal/repos"
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/logger/log"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/distro"
|
||||
"go.elara.ws/lure/internal/build"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
|
Loading…
Reference in New Issue
Block a user