log: output caller on debug, use stdout as default
This commit is contained in:
parent
050a479df7
commit
cde06f4f00
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user