Skip to content

Commit 1d34d02

Browse files
committed
Make default logs friendly; keep timestamps in --verbose
1 parent aeb296b commit 1d34d02

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cmd/analyze.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"context"
55
"fmt"
6+
"log"
67
"os"
78
"path/filepath"
89
"strings"
@@ -26,6 +27,8 @@ var stageDescriptions = map[string]string{
2627

2728
func runAnalysis(apkPath string, config *CLIConfig) error {
2829

30+
configureLogging(config.Verbose)
31+
2932
cliCfg := &analyzer.Config{
3033
DisableNetworkChecks: !config.EnableNetworkAndDNS,
3134
}
@@ -94,6 +97,16 @@ func displayVerboseProgress(evt analyzer.ProgressEvent) {
9497
}
9598
}
9699

100+
func configureLogging(verbose bool) {
101+
log.SetOutput(os.Stderr)
102+
if verbose {
103+
log.SetFlags(log.LstdFlags)
104+
return
105+
}
106+
// Friendly, timestamp-free logs for normal mode
107+
log.SetFlags(0)
108+
}
109+
97110
func displaySimpleProgress(evt analyzer.ProgressEvent, lastStage *string, lastPercent *int) {
98111

99112
if evt.Stage != *lastStage {

0 commit comments

Comments
 (0)