refactor: logs
This commit is contained in:
parent
8437d61df7
commit
75dd8f4a51
@ -37,7 +37,7 @@ func preload(q *qemu.System, ki distro.KernelInfo, pm PreloadModule,
|
||||
|
||||
var workPath, cache string
|
||||
if pm.Path != "" {
|
||||
log.Print("Use non-git path for preload module (no cache)")
|
||||
log.Debug().Msg("Use non-git path for preload module (no cache)")
|
||||
workPath = pm.Path
|
||||
} else if pm.Repo != "" {
|
||||
workPath, cache, err = cloneOrPull(pm.Repo, ki)
|
||||
@ -85,7 +85,7 @@ func buildAndInsmod(workPath string, q *qemu.System, ki distro.KernelInfo,
|
||||
|
||||
output, err := q.CopyAndInsmod(af)
|
||||
if err != nil {
|
||||
log.Print(output)
|
||||
log.Error().Err(err).Msg(output)
|
||||
return
|
||||
}
|
||||
return
|
||||
@ -147,7 +147,7 @@ func cloneOrPull(repo string, ki distro.KernelInfo) (workPath, cache string,
|
||||
|
||||
err = w.Pull(&git.PullOptions{})
|
||||
if err != nil && err != git.NoErrAlreadyUpToDate {
|
||||
log.Print(repo, "pull error:", err)
|
||||
log.Error().Err(err).Msgf("pull %s error", repo)
|
||||
}
|
||||
} else {
|
||||
r, err = git.PlainClone(workPath, false, &git.CloneOptions{URL: repo})
|
||||
|
10
cmd/debug.go
10
cmd/debug.go
@ -45,7 +45,7 @@ type DebugCmd struct {
|
||||
func (cmd *DebugCmd) Run(g *Globals) (err error) {
|
||||
kcfg, err := config.ReadKernelConfig(g.Config.Kernels)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
log.Error().Err(err).Msg("read kernel config")
|
||||
}
|
||||
|
||||
var configPath string
|
||||
@ -161,14 +161,14 @@ func (cmd *DebugCmd) Run(g *Globals) (err error) {
|
||||
// Module depends on one of the standard modules
|
||||
err = artifact.CopyStandardModules(q, ki)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
log.Error().Err(err).Msg("copy standard modules")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
err = artifact.PreloadModules(q, ka, ki, g.Config.Docker.Timeout.Duration)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
log.Error().Err(err).Msg("preload modules")
|
||||
return
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ func (cmd *DebugCmd) Run(g *Globals) (err error) {
|
||||
} else {
|
||||
buildDir, outFile, output, err = artifact.Build(log.Logger, tmp, ka, ki, g.Config.Docker.Timeout.Duration)
|
||||
if err != nil {
|
||||
log.Print(err, output)
|
||||
log.Error().Err(err).Msg(output)
|
||||
return
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ func (cmd *DebugCmd) Run(g *Globals) (err error) {
|
||||
}
|
||||
err = q.CopyFile(f.User, f.Local, f.Remote)
|
||||
if err != nil {
|
||||
log.Print("error copy err:", err, f.Local, f.Remote)
|
||||
log.Error().Err(err).Msgf("copy %s -> %s", f.Local, f.Remote)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ func (cmd *KernelCmd) Generate(g *Globals, km artifact.Target) (err error) {
|
||||
}
|
||||
|
||||
if cmd.stats.success >= cmd.Max {
|
||||
log.Print("Max is reached")
|
||||
log.Info().Msg("Max is reached")
|
||||
swg.Done()
|
||||
break
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ func (cmd *LogQueryCmd) Run(g *Globals) (err error) {
|
||||
|
||||
ka, kaErr := artifact.Artifact{}.Read(g.WorkDir + "/.out-of-tree.toml")
|
||||
if kaErr == nil {
|
||||
log.Print(".out-of-tree.toml found, filter by artifact name")
|
||||
log.Debug().Msg(".out-of-tree.toml found, filter by artifact name")
|
||||
les, err = getAllArtifactLogs(db, cmd.Tag, cmd.Num, ka)
|
||||
} else {
|
||||
les, err = getAllLogs(db, cmd.Tag, cmd.Num)
|
||||
|
@ -33,7 +33,7 @@ type PackCmd struct {
|
||||
|
||||
func (cmd *PackCmd) Run(g *Globals) (err error) {
|
||||
tag := fmt.Sprintf("pack_run_%d", time.Now().Unix())
|
||||
log.Print("Tag:", tag)
|
||||
log.Info().Msgf("Tag: %s", tag)
|
||||
|
||||
files, err := os.ReadDir(g.WorkDir)
|
||||
if err != nil {
|
||||
@ -65,7 +65,7 @@ func (cmd *PackCmd) Run(g *Globals) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
log.Print(f.Name())
|
||||
log.Info().Msg(f.Name())
|
||||
|
||||
pew := PewCmd{
|
||||
Max: cmd.KernelRuns,
|
||||
|
@ -34,7 +34,7 @@ func GenHostKernels(download bool) (kernels []distro.KernelInfo, err error) {
|
||||
|
||||
rawOutput, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Print(string(rawOutput), err)
|
||||
log.Error().Err(err).Msg(string(rawOutput))
|
||||
return
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ func GenHostKernels(download bool) (kernels []distro.KernelInfo, err error) {
|
||||
}
|
||||
|
||||
vmlinux := "/usr/lib/debug/boot/vmlinux-" + krel
|
||||
log.Print("vmlinux", vmlinux)
|
||||
log.Info().Msgf("vmlinux %s", vmlinux)
|
||||
if fs.PathExists(vmlinux) {
|
||||
ki.VmlinuxPath = vmlinux
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user