All core library components have comprehensive unit tests:
-
logger_test.go- 11 tests- Level filtering
- Structured fields
- Multiple sinks
- Caller tracing
- Close behavior
-
level_test.go- 2 tests- Level string conversion
- Level comparison
-
config_test.go- 4 tests- Default configuration
- Custom configuration
- Async configuration
- Configuration customization
formatter_test.go- 3 tests- Basic JSON formatting
- Fields in JSON output
- Caller in JSON output
sink_test.go- 3 tests- Console sink write/close
- File sink write/close
- Invalid file path handling
worker_test.go- 4 tests- Basic queue processing
- Multiple sinks
- High throughput (1000 logs)
- Graceful shutdown
Run all library tests:
go test ./logger ./formatter ./sink ./async -vRun with coverage:
go test ./logger ./formatter ./sink ./async -coverRun specific package:
go test ./logger -vAll 27 tests pass successfully:
- ✓ Logger: 11/11 tests passed
- ✓ Formatter: 3/3 tests passed
- ✓ Sink: 3/3 tests passed
- ✓ Async: 4/4 tests passed
- ✓ Config: 4/4 tests passed
- ✓ Level: 2/2 tests passed
| Package | Coverage | Status |
|---|---|---|
| logger | 69.1% | ✓ |
| formatter | 100% | ✓ |
| sink | 92.3% | ✓ |
| async | 90.9% | ✓ |
Overall: Excellent test coverage across all components.