1
0

Add debug logs for exec.Command

This commit is contained in:
2023-03-19 13:14:14 +00:00
parent 305c6972ca
commit 08beba2bab
6 changed files with 53 additions and 2 deletions

14
main.go
View File

@ -8,6 +8,7 @@ import (
"fmt"
"math/rand"
"os"
"strconv"
"time"
"github.com/rs/zerolog"
@ -69,6 +70,19 @@ func (v VersionFlag) BeforeApply(app *kong.Kong, vars kong.Vars) error {
func main() {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
zerolog.CallerMarshalFunc = func(pc uintptr, file string, line int) string {
short := file
for i := len(file) - 1; i > 0; i-- {
if file[i] == '/' {
short = file[i+1:]
break
}
}
file = short
return file + ":" + strconv.Itoa(line)
}
log.Logger = log.With().Caller().Logger()
rand.Seed(time.Now().UnixNano())
cli := CLI{}