mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
* add bubbletea UI Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * swap pipeline to go 1.20.x and add attest guard for cosign binary Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * update note in developing.md about the required golang version Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * fix merge conflict for windows path handling Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * temp test for attest handler Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add addtional test iterations for background reader Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
92 lines
2.3 KiB
Go
92 lines
2.3 KiB
Go
/*
|
|
Package log contains the singleton object and helper functions for facilitating logging within the syft library.
|
|
*/
|
|
package log
|
|
|
|
import (
|
|
"github.com/anchore/go-logger"
|
|
"github.com/anchore/go-logger/adapter/discard"
|
|
"github.com/anchore/go-logger/adapter/redact"
|
|
)
|
|
|
|
var (
|
|
// log is the singleton used to facilitate logging internally within
|
|
log = discard.New()
|
|
|
|
store = redact.NewStore()
|
|
|
|
Redactor = store.(redact.Redactor)
|
|
)
|
|
|
|
func Set(l logger.Logger) {
|
|
log = redact.New(l, store)
|
|
}
|
|
|
|
func Get() logger.Logger {
|
|
return log
|
|
}
|
|
|
|
func Redact(values ...string) {
|
|
store.Add(values...)
|
|
}
|
|
|
|
// Errorf takes a formatted template string and template arguments for the error logging level.
|
|
func Errorf(format string, args ...interface{}) {
|
|
log.Errorf(format, args...)
|
|
}
|
|
|
|
// Error logs the given arguments at the error logging level.
|
|
func Error(args ...interface{}) {
|
|
log.Error(args...)
|
|
}
|
|
|
|
// Warnf takes a formatted template string and template arguments for the warning logging level.
|
|
func Warnf(format string, args ...interface{}) {
|
|
log.Warnf(format, args...)
|
|
}
|
|
|
|
// Warn logs the given arguments at the warning logging level.
|
|
func Warn(args ...interface{}) {
|
|
log.Warn(args...)
|
|
}
|
|
|
|
// Infof takes a formatted template string and template arguments for the info logging level.
|
|
func Infof(format string, args ...interface{}) {
|
|
log.Infof(format, args...)
|
|
}
|
|
|
|
// Info logs the given arguments at the info logging level.
|
|
func Info(args ...interface{}) {
|
|
log.Info(args...)
|
|
}
|
|
|
|
// Debugf takes a formatted template string and template arguments for the debug logging level.
|
|
func Debugf(format string, args ...interface{}) {
|
|
log.Debugf(format, args...)
|
|
}
|
|
|
|
// Debug logs the given arguments at the debug logging level.
|
|
func Debug(args ...interface{}) {
|
|
log.Debug(args...)
|
|
}
|
|
|
|
// Tracef takes a formatted template string and template arguments for the trace logging level.
|
|
func Tracef(format string, args ...interface{}) {
|
|
log.Tracef(format, args...)
|
|
}
|
|
|
|
// Trace logs the given arguments at the trace logging level.
|
|
func Trace(args ...interface{}) {
|
|
log.Trace(args...)
|
|
}
|
|
|
|
// WithFields returns a message logger with multiple key-value fields.
|
|
func WithFields(fields ...interface{}) logger.MessageLogger {
|
|
return log.WithFields(fields...)
|
|
}
|
|
|
|
// Nested returns a new logger with hard coded key-value pairs
|
|
func Nested(fields ...interface{}) logger.Logger {
|
|
return log.Nested(fields...)
|
|
}
|