Package for telemetry/logging
- Multiple logging levels (Debug, Info, Warning, Error)
- Configurable logging backends (drivers)
- Transaction support for tracking related log entries
- JSON configuration
- Thread safe
There is an example in cmd/main.go
Configuration is done through the config.json like:
{
"driver": "console",
"driver_config": "logs.txt",
"log_level": 1,
"default_tags": {
"environment": "development",
"go_version": "1.22",
"app_version": "1.0.0"
}
}You can write your own driver by putting it into the drivers folder, and specifing it in the config.json. There are multiple drivers already, which can be used as an example or starting point.
- Using a buffer for logging
- More sophisticated error handling
- Log rotation configuration
- Clean up transaction code
- Write some more tests
Use it as you wish