Skip to content

Commit e2af5d6

Browse files
authored
Fix bugs (#43)
Co-authored-by: Tony Meehan <tonymeehan@users.noreply.github.com>
1 parent c6b2dcc commit e2af5d6

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

internal/pkg/resolve/logfactory.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func NewLogFactory(data []byte, opts ...OptT) (format.FactoryI, int64, error) {
7979
}
8080

8181
if err != nil {
82+
log.Error().Err(err).Msg("Failed to detect timestamp format")
8283
return nil, 0, err
8384
}
8485

internal/pkg/timez/timez.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ func TryTimestampFormat(exp string, fmtStr TimestampFmt, buf []byte, maxTries in
112112
Msg("Trying timestamp format")
113113

114114
if cb, err = GetTimestampFormat(fmtStr); err != nil {
115-
log.Error().Err(err).Msg("Failed to get timestamp format")
115+
log.Warn().Err(err).Msg("Failed to get timestamp format")
116116
return nil, 0, err
117117
}
118118

119119
if factory, err = format.NewRegexFactory(exp, cb); err != nil {
120-
log.Error().Err(err).Msg("Failed to create regex factory")
120+
log.Warn().Err(err).Msg("Failed to create regex factory")
121121
return nil, 0, err
122122
}
123123

@@ -137,7 +137,7 @@ func TryTimestampFormat(exp string, fmtStr TimestampFmt, buf []byte, maxTries in
137137
}
138138

139139
if err != nil {
140-
log.Info().Err(err).Msg("Failed to read timestamp")
140+
log.Warn().Err(err).Msg("Failed to read timestamp")
141141
return nil, 0, err
142142
}
143143

internal/pkg/ux/report.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ const (
3030
sevHigh = "high"
3131
sevMedium = "medium"
3232
sevLow = "low"
33+
sevInfo = "info"
3334
colorCritical = text.FgHiRed
3435
colorHigh = text.FgHiYellow
3536
colorMedium = text.FgHiMagenta
3637
colorLow = text.FgHiGreen
38+
colorInfo = text.FgHiBlue
3739
reportFmt = "preq-report-%d.json"
3840
)
3941

@@ -42,7 +44,7 @@ const (
4244
)
4345

4446
var (
45-
sevWidth = max(len(sevCritical), len(sevHigh), len(sevMedium), len(sevLow))
47+
sevWidth = max(len(sevCritical), len(sevHigh), len(sevMedium), len(sevLow), len(sevInfo))
4648
retries = uint(3)
4749
delay = time.Second * 5
4850
)
@@ -143,6 +145,11 @@ func getSeverity(severity uint) (*severityT, error) {
143145
severity: sevLow,
144146
color: colorLow,
145147
}, nil
148+
case parser.SeverityInfo:
149+
return &severityT{
150+
severity: sevInfo,
151+
color: colorInfo,
152+
}, nil
146153
}
147154

148155
return nil, ErrInvalidSeverity

0 commit comments

Comments
 (0)