Skip to content

Commit

Permalink
fixed logs issue #19931
Browse files Browse the repository at this point in the history
  • Loading branch information
mattisafur committed Dec 20, 2024
1 parent 0dbe96a commit c1bbbb9
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions cmd/minikube/cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,34 @@ var logsCmd = &cobra.Command{
if err != nil {
exit.Error(reason.Usage, "Failed to create file", err)
}
out.SetOutFile(logOutput)
defer out.SetOutFile(os.Stdout)
out.SetErrFile(logOutput)
defer out.SetErrFile(os.Stderr)
}
if lastStartOnly {
err := logs.OutputLastStart()

switch {
case lastStartOnly:
err = logs.OutputLastStart()
if err != nil {
klog.Errorf("failed to output last start logs: %v", err)
}
return
}
if auditLogs {
err := logs.OutputAudit(numberOfLines)
case auditLogs:
err = logs.OutputAudit(numberOfLines)
if err != nil {
klog.Errorf("failed to output audit logs: %v", err)
klog.Errorf("failed to output last start logs: %v", err)
}
return
default:
err = logs.OutputLastStart()
if err != nil {
klog.Errorf("failed to output last start logs: %v", err)
}
err = logs.OutputAudit(numberOfLines)
if err != nil {
klog.Errorf("failed to output last start logs: %v", err)
}
out.Styled(style.None, "")
}
logs.OutputOffline(numberOfLines, logOutput)

if shouldSilentFail() {
return
Expand Down

0 comments on commit c1bbbb9

Please sign in to comment.