File: log.go

package info (click to toggle)
golang-github-aquasecurity-go-dep-parser 0.0~git20220110.4a30ebc-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 19,096 kB
  • sloc: xml: 673; php: 7; makefile: 4
file content (32 lines) | stat: -rw-r--r-- 884 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package jar

import "github.com/aquasecurity/go-dep-parser/pkg/log"

// logger implements LeveledLogger
// https://github.com/hashicorp/go-retryablehttp/blob/991b9d0a42d13014e3689dd49a94c02be01f4237/client.go#L285-L290
type logger struct{}

func (logger) Error(msg string, keysAndValues ...interface{}) {
	// Use Debugw to suppress errors on failure
	if msg == "request failed" {
		log.Logger.Debugw(msg, keysAndValues...)
		return
	}
	log.Logger.Errorw(msg, keysAndValues)
}

func (logger) Info(msg string, keysAndValues ...interface{}) {
	log.Logger.Infow(msg, keysAndValues...)
}

func (logger) Debug(msg string, keysAndValues ...interface{}) {
	// This message is displayed too much
	if msg == "performing request" {
		return
	}
	log.Logger.Debugw(msg, keysAndValues...)
}

func (logger) Warn(msg string, keysAndValues ...interface{}) {
	log.Logger.Warnw(msg, keysAndValues...)
}