mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 15:06:36 +01:00
add logging fields
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package log
|
||||
|
||||
import "github.com/anchore/imgbom/imgbom/logger"
|
||||
|
||||
var Log logger.Logger = &nopLogger{}
|
||||
|
||||
func Errorf(format string, args ...interface{}) {
|
||||
Log.Errorf(format, args...)
|
||||
}
|
||||
|
||||
func Infof(format string, args ...interface{}) {
|
||||
Log.Infof(format, args...)
|
||||
}
|
||||
|
||||
func Info(args ...interface{}) {
|
||||
Log.Info(args...)
|
||||
}
|
||||
|
||||
func Debugf(format string, args ...interface{}) {
|
||||
Log.Debugf(format, args...)
|
||||
}
|
||||
|
||||
func Debug(args ...interface{}) {
|
||||
Log.Debug(args...)
|
||||
}
|
||||
|
||||
func WithFields(fields map[string]interface{}) logger.Logger {
|
||||
return Log.WithFields(fields)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package log
|
||||
|
||||
import "github.com/anchore/imgbom/imgbom/logger"
|
||||
|
||||
type nopLogger struct{}
|
||||
|
||||
func (l *nopLogger) Errorf(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{}) {}
|
||||
func (l *nopLogger) Debug(args ...interface{}) {}
|
||||
func (l *nopLogger) WithFields(fields map[string]interface{}) logger.Logger { return &nopLogger{} }
|
||||
Reference in New Issue
Block a user