@@ -12,21 +12,21 @@ import (
1212
1313func TestLoggerFactory (t * testing.T ) {
1414 factory := NewLoggerFactory ()
15-
15+
1616 t .Run ("creates working logger" , func (t * testing.T ) {
1717 config := Config {Level : slog .LevelInfo , Verbose : true }
1818 logger := factory .CreateLogger (config )
19-
19+
2020 if logger == nil {
2121 t .Fatal ("factory should create logger" )
2222 }
2323 })
24-
24+
2525 t .Run ("creates independent instances" , func (t * testing.T ) {
2626 config := Config {Level : slog .LevelInfo }
2727 logger1 := factory .CreateLogger (config )
2828 logger2 := factory .CreateLogger (config )
29-
29+
3030 if logger1 == logger2 {
3131 t .Error ("factory should create independent instances" )
3232 }
@@ -36,15 +36,15 @@ func TestLoggerFactory(t *testing.T) {
3636func TestDualHandler (t * testing.T ) {
3737 var buf bytes.Buffer
3838 handler := NewDualHandler (& buf , false , slog .LevelInfo )
39-
39+
4040 record := slog .NewRecord (time .Now (), slog .LevelInfo , "test message" , 0 )
4141 record .Add ("key" , "value" )
42-
42+
4343 err := handler .Handle (context .Background (), record )
4444 if err != nil {
4545 t .Fatalf ("handler failed: %v" , err )
4646 }
47-
47+
4848 output := buf .String ()
4949 if ! strings .Contains (output , "test message" ) {
5050 t .Error ("output should contain message" )
@@ -57,17 +57,17 @@ func TestDualHandler(t *testing.T) {
5757func TestRequestIDFunctions (t * testing.T ) {
5858 id1 := GenerateRequestID ()
5959 id2 := GenerateRequestID ()
60-
60+
6161 if id1 == id2 {
6262 t .Error ("IDs should be unique" )
6363 }
6464 if ! strings .HasPrefix (id1 , "req_" ) {
6565 t .Error ("ID should have req_ prefix" )
6666 }
67-
67+
6868 ctx := ContextWithRequestID (context .Background (), "test123" )
6969 retrieved := RequestIDFromContext (ctx )
70-
70+
7171 if retrieved != "test123" {
7272 t .Errorf ("expected test123, got %s" , retrieved )
7373 }
@@ -76,10 +76,10 @@ func TestRequestIDFunctions(t *testing.T) {
7676func TestGlobalLogger (t * testing.T ) {
7777 // Test that global functions work
7878 Info ("test info message" )
79- Debug ("test debug message" )
79+ Debug ("test debug message" )
8080 Warn ("test warn message" )
8181 Error ("test error message" )
82-
82+
8383 logger := Global ()
8484 if logger == nil {
8585 t .Error ("Global() should return logger" )
@@ -93,17 +93,17 @@ func TestLoggerWithFile(t *testing.T) {
9393 }
9494 defer os .Remove (tempFile .Name ())
9595 tempFile .Close ()
96-
96+
9797 factory := NewLoggerFactory ()
9898 logger := factory .CreateLogger (Config {
9999 Level : slog .LevelInfo ,
100100 LogFilePath : tempFile .Name (),
101101 })
102-
102+
103103 logger .Info ("test file logging" )
104-
104+
105105 err = logger .Close ()
106106 if err != nil {
107107 t .Errorf ("Close should not error: %v" , err )
108108 }
109- }
109+ }
0 commit comments