Implement a more better logging solution

This commit is contained in:
2025-03-27 17:47:39 +01:00
parent 81d8259dfc
commit 9cea103042
7 changed files with 579 additions and 78 deletions

22
processor/test_helper.go Normal file
View File

@@ -0,0 +1,22 @@
package processor
import (
"io/ioutil"
"modify/logger"
"os"
)
func init() {
// Initialize logger with ERROR level for tests
// to minimize noise in test output
logger.Init(logger.LevelError)
// Optionally redirect logger output to discard
// This prevents logger output from interfering with test output
disableTestLogs := os.Getenv("ENABLE_TEST_LOGS") != "1"
if disableTestLogs {
// Create a new logger that writes to nowhere
silentLogger := logger.New(ioutil.Discard, "", 0)
logger.DefaultLogger = silentLogger
}
}