| 430 | } |
| 431 | |
| 432 | func TestLogger_ConcurrentAccess(t *testing.T) { |
| 433 | var buf bytes.Buffer |
| 434 | config := &Config{ |
| 435 | Level: LevelInfo, |
| 436 | Output: &buf, |
| 437 | } |
| 438 | |
| 439 | logger, err := NewLogger(config) |
| 440 | require.NoError(t, err) |
| 441 | defer logger.Close() |
| 442 | |
| 443 | // Test concurrent logging |
| 444 | done := make(chan bool, 10) |
| 445 | |
| 446 | for i := 0; i < 10; i++ { |
| 447 | go func(id int) { |
| 448 | logger.Info("concurrent message %d", id) |
| 449 | done <- true |
| 450 | }(i) |
| 451 | } |
| 452 | |
| 453 | // Wait for all goroutines to complete |
| 454 | for i := 0; i < 10; i++ { |
| 455 | <-done |
| 456 | } |
| 457 | |
| 458 | output := buf.String() |
| 459 | |
| 460 | // Should contain all messages |
| 461 | for i := 0; i < 10; i++ { |
| 462 | assert.Contains(t, output, "concurrent message") |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | // TestLogger_InterfaceCompliance verifies that Logger implements interfaces.Logger. |
| 467 | func TestLogger_InterfaceCompliance(t *testing.T) { |