mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
Use warn instead of error for packages with no matchers (#113)
* Add warn method to logging system Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Move from error to warn for no matcher scenario Signed-off-by: Dan Luhring <dan.luhring@anchore.com>
This commit is contained in:
parent
50d7251a0b
commit
219d8bcf0f
5 changed files with 15 additions and 1 deletions
|
@ -2,6 +2,7 @@ package logger
|
|||
|
||||
type Logger interface {
|
||||
Errorf(format string, args ...interface{})
|
||||
Warnf(format string, args ...interface{})
|
||||
Infof(format string, args ...interface{})
|
||||
Info(args ...interface{})
|
||||
Debugf(format string, args ...interface{})
|
||||
|
|
|
@ -87,7 +87,7 @@ func (c *controller) findMatches(provider vulnerability.Provider, d distro.Distr
|
|||
|
||||
matchers, ok := c.matchers[p.Type]
|
||||
if !ok {
|
||||
log.Errorf("no matchers available for package pkg=%s", p)
|
||||
log.Warnf("no matchers available for package pkg=%s", p)
|
||||
}
|
||||
for _, m := range matchers {
|
||||
matches, err := m.Match(provider, d, p)
|
||||
|
|
|
@ -8,6 +8,10 @@ func Errorf(format string, args ...interface{}) {
|
|||
Log.Errorf(format, args...)
|
||||
}
|
||||
|
||||
func Warnf(format string, args ...interface{}) {
|
||||
Log.Warnf(format, args...)
|
||||
}
|
||||
|
||||
func Infof(format string, args ...interface{}) {
|
||||
Log.Infof(format, args...)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package log
|
|||
type nopLogger struct{}
|
||||
|
||||
func (l *nopLogger) Errorf(format string, args ...interface{}) {}
|
||||
func (l *nopLogger) Warnf(format string, args ...interface{}) {}
|
||||
func (l *nopLogger) Infof(format string, args ...interface{}) {}
|
||||
func (l *nopLogger) Info(args ...interface{}) {}
|
||||
func (l *nopLogger) Debugf(format string, args ...interface{}) {}
|
||||
|
|
|
@ -90,6 +90,10 @@ func (l *LogrusLogger) Info(args ...interface{}) {
|
|||
l.Logger.Info(args...)
|
||||
}
|
||||
|
||||
func (l *LogrusLogger) Warnf(format string, args ...interface{}) {
|
||||
l.Logger.Warnf(format, args...)
|
||||
}
|
||||
|
||||
func (l *LogrusLogger) Errorf(format string, args ...interface{}) {
|
||||
l.Logger.Errorf(format, args...)
|
||||
}
|
||||
|
@ -110,6 +114,10 @@ func (l *LogrusNestedLogger) Info(args ...interface{}) {
|
|||
l.Logger.Info(args...)
|
||||
}
|
||||
|
||||
func (l *LogrusNestedLogger) Warnf(format string, args ...interface{}) {
|
||||
l.Logger.Warnf(format, args...)
|
||||
}
|
||||
|
||||
func (l *LogrusNestedLogger) Errorf(format string, args ...interface{}) {
|
||||
l.Logger.Errorf(format, args...)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue