Package Usage: go: github.com/rs/zerolog
Package zerolog provides a lightweight logging library dedicated to JSON logging.
A global Logger can be use for simple logging:
NOTE: To import the global logger, import the "log" subpackage "github.com/rs/zerolog/log".
Fields can be added to log messages:
Create logger instance to manage different outputs:
Sub-loggers let you chain loggers with additional context:
Level logging
Customize automatic field names:
Log with no level and message:
Add contextual fields to global Logger:
Sample logs:
Log with contextual hooks:
Field duplication:
There is no fields deduplication out-of-the-box.
Using the same key multiple times creates new key in final JSON each time.
In this case, many consumers will take the last value,
but this is not guaranteed; check yours if in doubt.
Concurrency safety:
Be careful when calling UpdateContext. It is not concurrency safe. Use the With method to create a child logger:
51 versions
Latest release: over 1 year ago
14,089 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/rs/zerolog
Dependent Repos 6
1024pix/steampipe-plugin-metabase
Use SQL to query databases, tables, permissions and more from MetabaseSize: 1.22 MB - Last synced: 6 days ago - Pushed: 28 days ago

snps-public/cephfs-foldersize-exporter
Prometheus exporter for CephFS various folder sizesLast synced: 8 months ago - Pushed: 12 months ago
snps-public/rest-samba-config
Rest API used to view (and maybe at some point edit) Samba configurationLast synced: 8 months ago - Pushed: 12 months ago
1024pix/go-metabase Fork of grokify/go-metabase
Go Client SDK for Metabase - https://github.com/metabase/metabaseSize: 361 KB - Last synced: 6 days ago - Pushed: 8 months ago

1024pix/goauth Fork of grokify/goauth
Utility libraries for Go (aka Golang) API auth including OAuth 2, JWT, TLS Client Authentication and Basic Auth.Size: 737 KB - Last synced: 6 days ago - Pushed: about 1 year ago

MTES-MCT/filharmonic-api 📦
API of Fil'HarmonicSize: 870 KB - Last synced: about 1 hour ago - Pushed: about 6 years ago
