feat: more info logs

This commit is contained in:
张泊明518370910136 2024-09-26 05:43:37 -04:00
parent f665e5b2b1
commit 9800becc96
GPG Key ID: D47306D7062CDA9D
3 changed files with 7 additions and 4 deletions

View File

@ -122,13 +122,16 @@ func parseConfFile(path string) (conf Conf, err error) {
} }
func msgToConf(metaConfPath string, msg string) (conf Conf, err error) { func msgToConf(metaConfPath string, msg string) (conf Conf, err error) {
slog.Info("msg to conf", "msg", msg)
metaConf, err := parseMetaConfFile(metaConfPath) metaConf, err := parseMetaConfFile(metaConfPath)
if err != nil { if err != nil {
return return
} }
for _, pattern := range metaConf.Patterns { for _, pattern := range metaConf.Patterns {
if matched, _ := regexp.MatchString(pattern.Regex, msg); matched { if matched, _ := regexp.MatchString(pattern.Regex, msg); matched {
slog.Debug("pattern matched", "pattern", pattern) slog.Debug("pattern matched",
"pattern", pattern, "filename", pattern.Filename)
slog.Info("pattern matched", "filename", pattern.Filename)
return parseConfFile(pattern.Filename) return parseConfFile(pattern.Filename)
} }
} }

View File

@ -2,7 +2,6 @@ package keyword
import ( import (
"fmt" "fmt"
"log/slog"
"strings" "strings"
"focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage" "focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/internal/stage"
@ -31,7 +30,6 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) (
matched := false matched := false
for _, file := range conf.Files { for _, file := range conf.Files {
content := executorResult.Files[file] content := executorResult.Files[file]
slog.Debug("file content", "file", file, "content", content)
for _, match := range conf.Matches { for _, match := range conf.Matches {
count := strings.Count(content, match.Keyword) count := strings.Count(content, match.Keyword)
if count > 0 { if count > 0 {

View File

@ -10,7 +10,8 @@ func Run(stages []Stage) (stageResults []StageResult, err error) {
var parserResults []ParserResult var parserResults []ParserResult
var forceQuit bool var forceQuit bool
for _, stage := range stages { for _, stage := range stages {
slog.Debug("stage start", "name", stage.Name) slog.Info("stage start", "name", stage.Name)
slog.Info("executor run start")
slog.Debug("executor run start", "cmds", stage.ExecutorCmds) slog.Debug("executor run start", "cmds", stage.ExecutorCmds)
executor, ok := executorMap[stage.ExecutorName] executor, ok := executorMap[stage.ExecutorName]
if !ok { if !ok {
@ -24,6 +25,7 @@ func Run(stages []Stage) (stageResults []StageResult, err error) {
return return
} }
slog.Debug("executor run done", "results", executorResults) slog.Debug("executor run done", "results", executorResults)
slog.Info("parser run start")
slog.Debug("parser run start", "conf", stage.ParserConf) slog.Debug("parser run start", "conf", stage.ParserConf)
parser, ok := parserMap[stage.ParserName] parser, ok := parserMap[stage.ParserName]
if !ok { if !ok {