push detailed log statements to trace-level (#1500)

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2023-01-20 14:33:23 +00:00
committed by GitHub
parent 396441e921
commit 36a0945c95
4 changed files with 68 additions and 48 deletions
+9 -6
View File
@@ -28,7 +28,8 @@ func (c *Cataloger) WithParserByGlobs(parser Parser, globs ...string) *Cataloger
func(resolver source.FileResolver, env Environment) []request {
var requests []request
for _, g := range globs {
// TODO: add more trace logging here
log.WithFields("glob", g).Trace("searching for paths matching glob")
matches, err := resolver.FilesByGlob(g)
if err != nil {
log.Warnf("unable to process glob=%q: %+v", g, err)
@@ -47,7 +48,8 @@ func (c *Cataloger) WithParserByMimeTypes(parser Parser, types ...string) *Catal
func(resolver source.FileResolver, env Environment) []request {
var requests []request
for _, t := range types {
// TODO: add more trace logging here
log.WithFields("mimetype", t).Trace("searching for paths matching mimetype")
matches, err := resolver.FilesByMIMEType(t)
if err != nil {
log.Warnf("unable to process mimetype=%q: %+v", t, err)
@@ -65,11 +67,12 @@ func (c *Cataloger) WithParserByPath(parser Parser, paths ...string) *Cataloger
c.processor = append(c.processor,
func(resolver source.FileResolver, env Environment) []request {
var requests []request
for _, g := range paths {
// TODO: add more trace logging here
matches, err := resolver.FilesByPath(g)
for _, p := range paths {
log.WithFields("path", p).Trace("searching for path")
matches, err := resolver.FilesByPath(p)
if err != nil {
log.Warnf("unable to process path=%q: %+v", g, err)
log.Warnf("unable to process path=%q: %+v", p, err)
continue
}
requests = append(requests, makeRequests(parser, matches)...)