From 2e3e958e15da489d0f6814ae2096ad240f9dca94 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Fri, 28 Mar 2025 23:22:49 +0100 Subject: [PATCH] Fix some tests and add some logs --- .vscode/launch.json | 7 +++---- main.go | 14 +++++++++++++- processor/regex_test.go | 3 +-- regression/regression_test.go | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index ded79ea..17f8277 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,11 +12,10 @@ "program": "${workspaceFolder}", "cwd": "C:/Users/Administrator/Seafile/Games-Barotrauma", "args": [ - "loglevel", + "-loglevel", "trace", - "(?-s)LightComponent!anyrange=\"(!num)\"", - "*4", - "**/Outpost*.xml" + "-cook", + "*.yml", ] }, { diff --git a/main.go b/main.go index 3b6a344..2f21f3e 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "sort" + "strings" "sync" "time" @@ -80,6 +81,17 @@ func main() { globs := utils.AggregateGlobs(commands) logger.Debug("Aggregated %d globs before deduplication", utils.CountGlobsBeforeDedup(commands)) + for _, command := range commands { + logger.Trace("Command: %s", command.Name) + logger.Trace("Regex: %s", command.Regex) + logger.Trace("Files: %v", command.Files) + logger.Trace("Lua: %s", command.Lua) + logger.Trace("Git: %t", command.Git) + logger.Trace("Reset: %t", command.Reset) + logger.Trace("Isolate: %t", command.Isolate) + logger.Trace("LogLevel: %s", command.LogLevel) + } + // Resolve all the files for all the globs logger.Info("Found %d unique file patterns", len(globs)) files, err := utils.ExpandGLobs(globs) @@ -271,7 +283,7 @@ func RunIsolateCommands(association utils.FileCommandAssociation, file string, f } if len(modifications) == 0 { - logger.Info("No modifications found for file %q", file) + logger.Warning("No modifications found for file %q", file) return nil } diff --git a/processor/regex_test.go b/processor/regex_test.go index 10b49c5..1209aa0 100644 --- a/processor/regex_test.go +++ b/processor/regex_test.go @@ -2,7 +2,6 @@ package processor import ( "bytes" - "fmt" "io" "modify/utils" "os" @@ -38,7 +37,7 @@ func ApiAdaptor(content string, regex string, lua string) (string, int, int, err LogLevel: "TRACE", } - commands, err := ProcessRegex(content, command) + commands, err := ProcessRegex(content, command, "test") if err != nil { return "", 0, 0, err } diff --git a/regression/regression_test.go b/regression/regression_test.go index aca7a91..d03e7c2 100644 --- a/regression/regression_test.go +++ b/regression/regression_test.go @@ -15,7 +15,7 @@ func ApiAdaptor(content string, regex string, lua string) (string, int, int, err LogLevel: "TRACE", } - commands, err := processor.ProcessRegex(content, command) + commands, err := processor.ProcessRegex(content, command, "test") if err != nil { return "", 0, 0, err }