Fix logger
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
package processor
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"modify/logger"
|
||||
"os"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Only modify logger in test mode
|
||||
// This checks if we're running under 'go test'
|
||||
if os.Getenv("GO_TESTING") == "1" || os.Getenv("TESTING") == "1" {
|
||||
// Initialize logger with ERROR level for tests
|
||||
// to minimize noise in test output
|
||||
logger.Init(logger.LevelError)
|
||||
@@ -16,7 +19,8 @@ func init() {
|
||||
disableTestLogs := os.Getenv("ENABLE_TEST_LOGS") != "1"
|
||||
if disableTestLogs {
|
||||
// Create a new logger that writes to nowhere
|
||||
silentLogger := logger.New(ioutil.Discard, "", 0)
|
||||
silentLogger := logger.New(io.Discard, "", 0)
|
||||
logger.DefaultLogger = silentLogger
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user