diff options
-rw-r--r-- | src/gobang.go | 4 | ||||
-rw-r--r-- | tests/gobang.go | 30 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/gobang.go b/src/gobang.go index fc8e2f0..c8ab0f3 100644 --- a/src/gobang.go +++ b/src/gobang.go @@ -754,7 +754,7 @@ func AssertEqualI(i int, given any, expected any) { } var unfilteringLevel = new(slog.LevelVar) -func setLoggerOutput(w io.Writer, args ...any) { +func SetLoggerOutput(w io.Writer, args ...any) { unfilteringLevel.Set(slog.LevelDebug) slog.SetDefault(slog.New(slog.NewJSONHandler(w, &slog.HandlerOptions { Level: unfilteringLevel, @@ -838,7 +838,7 @@ func setHostname() { } func Init(args ...any) { - setLoggerOutput(os.Stdout, args...) + SetLoggerOutput(os.Stdout, args...) setLogLevel() setMetric() setTraceback() diff --git a/tests/gobang.go b/tests/gobang.go index a1e3bb7..b26fc7e 100644 --- a/tests/gobang.go +++ b/tests/gobang.go @@ -575,7 +575,7 @@ func testLog( savedLevel := level s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) level = filterLevel fn("a-message", "a-type", "a-key", "a-value") @@ -632,7 +632,7 @@ func testNoLog(filterLevel LogLevel, fn func(string, string, ...any)) { savedLevel := level s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) level = filterLevel fn("a-message", "a-type", "a-key", "a-value") @@ -698,7 +698,7 @@ func test_metric() { savedFlag := emitMetric s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) emitMetric = false metric("", "") @@ -713,7 +713,7 @@ func test_metric() { savedFlag := emitMetric s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) emitMetric = true metric("a-type", "a-label", "count-something", 123) @@ -785,7 +785,7 @@ func test_MakeCounter() { savedFlag := emitMetric s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) emitMetric = true emitTCPError := MakeCounter("emit-tcp-error") @@ -832,7 +832,7 @@ func test_MakeGauge() { savedLevel := level s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) level = LevelError activeTCPConnections := MakeGauge("active-tcp-connections") @@ -883,7 +883,7 @@ func test_MakeGauge() { savedFlag := emitMetric s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) emitMetric = true activeTCPConnections := MakeGauge("active-tcp-connections") @@ -970,14 +970,14 @@ func test_showColour() { ErrorIf(os.Setenv(NAME, savedEnvvar)) } -func test_setLoggerOutput() { - TestStart("setLoggerOutput()") +func test_SetLoggerOutput() { + TestStart("SetLoggerOutput()") savedLogger := slog.Default() Testing("the output JSON has data under \"src\"", func() { s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) Info("", "") var data map[string]interface{} @@ -1000,7 +1000,7 @@ func test_setLoggerOutput() { AssertEqual(ok, true) function, ok := functionRaw.(string) AssertEqual(ok, true) - AssertEqual(function, "gobang.test_setLoggerOutput.func1") + AssertEqual(function, "gobang.test_SetLoggerOutput.func1") lineRaw, ok := src["line"] AssertEqual(ok, true) @@ -1010,7 +1010,7 @@ func test_setLoggerOutput() { Testing("the output JSON has data under \"info\"", func() { s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) Info("", "") var data map[string]interface{} @@ -1044,7 +1044,7 @@ func test_setLoggerOutput() { Testing("we can add groups to the default logger", func() { s := new(strings.Builder) - setLoggerOutput(s, slog.Group("one", "key", "value")) + SetLoggerOutput(s, slog.Group("one", "key", "value")) Info("", "") var data map[string]interface{} @@ -1064,7 +1064,7 @@ func test_setLoggerOutput() { Testing("the puuid is the same across calls to the logger", func() { s := new(strings.Builder) - setLoggerOutput(s) + SetLoggerOutput(s) Info("", "first") Info("", "second") @@ -1290,7 +1290,7 @@ func t4() { test_ErrorIf() test_ErrorNil() test_showColour() - test_setLoggerOutput() + test_SetLoggerOutput() test_levelFromString() test_setLogLevel() test_SetLevel() |