diff --git a/cli/cli.go b/cli/cli.go index 30c969d2..a3dfe4e2 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -17,6 +17,7 @@ import ( "coopcloud.tech/abra/pkg/config" "coopcloud.tech/abra/pkg/log" "coopcloud.tech/abra/pkg/web" + charmLog "github.com/charmbracelet/log" "github.com/urfave/cli" ) @@ -183,6 +184,7 @@ func newAbraApp(version, commit string) *cli.App { } } + charmLog.SetDefault(log.Logger) log.Debugf("abra version %s, commit %s", version, commit) return nil diff --git a/cli/internal/cli.go b/cli/internal/cli.go index 14e2acbd..df77ffcc 100644 --- a/cli/internal/cli.go +++ b/cli/internal/cli.go @@ -289,6 +289,7 @@ func SubCommandBefore(c *cli.Context) error { if Debug { log.SetLevel(log.DebugLevel) log.SetOutput(os.Stderr) + log.SetReportCaller(true) } return nil diff --git a/pkg/log/log.go b/pkg/log/log.go index adb8bef3..9e19f45d 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -7,27 +7,28 @@ import ( charmLog "github.com/charmbracelet/log" ) -// Log is the central logging interface. -var log = charmLog.NewWithOptions(os.Stderr, charmLog.Options{ - ReportCaller: true, +// Logger is the central logging interface. +var Logger = charmLog.NewWithOptions(os.Stdout, charmLog.Options{ + ReportCaller: false, ReportTimestamp: false, }) -var Fatal = log.Fatal -var Fatalf = log.Fatalf +var Fatal = Logger.Fatal +var Fatalf = Logger.Fatalf -var Debug = log.Debug -var Debugf = log.Debugf +var Debug = Logger.Debug +var Debugf = Logger.Debugf -var Info = log.Info -var Infof = log.Infof +var Info = Logger.Info +var Infof = Logger.Infof -var Warn = log.Warn -var Warnf = log.Warnf +var Warn = Logger.Warn +var Warnf = Logger.Warnf -var Error = log.Error -var Errorf = log.Errorf +var Error = Logger.Error +var Errorf = Logger.Errorf -var SetLevel = log.SetLevel +var SetLevel = Logger.SetLevel var DebugLevel = charmLog.DebugLevel var SetOutput = charmLog.SetOutput +var SetReportCaller = charmLog.SetReportCaller