From 57536d982c4a317eddc7cc271b7bc59a388618b7 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Wed, 18 Feb 2026 16:00:50 +0100 Subject: [PATCH] Add log output and fix bugs in AppTagger --- internal/tagger/detectApp.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/tagger/detectApp.go b/internal/tagger/detectApp.go index 5519cbf0..bd5faed8 100644 --- a/internal/tagger/detectApp.go +++ b/internal/tagger/detectApp.go @@ -52,7 +52,10 @@ func (t *AppTagger) scanApp(f *os.File, fns string) { ai := appInfo{tag: tag, patterns: make([]*regexp.Regexp, 0)} for scanner.Scan() { - line := scanner.Text() + line := strings.TrimSpace(scanner.Text()) + if line == "" { + continue + } re, err := regexp.Compile(line) if err != nil { cclog.Errorf("invalid regex pattern '%s' in %s: %v", line, fns, err) @@ -68,6 +71,8 @@ func (t *AppTagger) scanApp(f *os.File, fns string) { break } } + + cclog.Infof("AppTagger loaded %d patterns for %s", len(ai.patterns), tag) t.apps = append(t.apps, ai) } @@ -86,6 +91,9 @@ func (t *AppTagger) EventCallback() { } for _, fn := range files { + if fn.IsDir() { + continue + } fns := fn.Name() cclog.Debugf("Process: %s", fns) f, err := os.Open(filepath.Join(t.cfgPath, fns)) @@ -121,6 +129,9 @@ func (t *AppTagger) Register() error { } for _, fn := range files { + if fn.IsDir() { + continue + } fns := fn.Name() cclog.Debugf("Process: %s", fns) f, err := os.Open(filepath.Join(t.cfgPath, fns)) @@ -164,8 +175,8 @@ func (t *AppTagger) Match(job *schema.Job) { if re.MatchString(jobscriptLower) { if !r.HasTag(id, t.tagType, a.tag) { r.AddTagOrCreateDirect(id, t.tagType, a.tag) - break out } + break out } } }