https://github.com/euskadi31/zerolog-ecs
Elastic Common Schema (ECS) for Zerolog
https://github.com/euskadi31/zerolog-ecs
Last synced: 3 months ago
JSON representation
Elastic Common Schema (ECS) for Zerolog
- Host: GitHub
- URL: https://github.com/euskadi31/zerolog-ecs
- Owner: euskadi31
- License: mit
- Created: 2022-01-19T21:48:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-26T09:41:46.000Z (3 months ago)
- Last Synced: 2025-02-26T10:34:44.973Z (3 months ago)
- Language: Go
- Size: 43 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Elastic Common Schema (ECS) for Zerolog
Apply [ECS](https://www.elastic.co/guide/en/ecs/1.12/index.html) json structure to [Zerolog](https://github.com/rs/zerolog) library.
Example:
With global logger
```
package mainimport (
"github.com/rs/zerolog/log"
"github.com/euskadi31/zerolog-ecs"
ecsaws "github.com/euskadi31/zerolog-ecs/feature/aws"
)func main() {
_ = zerologecs.Configure(zerologecs.WithServiceName("hello-bin"))
_ = ecsaws.Configure()log.Info().Msg("hello")
}```
With new logger
```
package mainimport (
"github.com/rs/zerolog/log"
"github.com/euskadi31/zerolog-ecs"
ecsaws "github.com/euskadi31/zerolog-ecs/feature/aws"
)func main() {
logger := zerolog.New()logger = zerologecs.Configure(zerologecs.WithLogger(logger), zerologecs.WithServiceName("hello-bin"))
logger = ecsaws.Configure(zerologecs.WithLogger(logger))logger.Info().Msg("hello")
}```
## License
zerolog-ecs is licensed under the [MIT license](LICENSE.md).