{"id":16639501,"url":"https://github.com/borchero/zeus","last_synced_at":"2025-07-17T12:37:39.246Z","repository":{"id":57678931,"uuid":"489812401","full_name":"borchero/zeus","owner":"borchero","description":"Context-Based Logging Package for Go.","archived":false,"fork":false,"pushed_at":"2022-05-13T00:17:29.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T16:51:22.118Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/borchero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-08T00:41:55.000Z","updated_at":"2022-07-04T11:33:34.000Z","dependencies_parsed_at":"2022-09-10T13:51:44.612Z","dependency_job_id":null,"html_url":"https://github.com/borchero/zeus","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/borchero/zeus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borchero%2Fzeus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borchero%2Fzeus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borchero%2Fzeus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borchero%2Fzeus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borchero","download_url":"https://codeload.github.com/borchero/zeus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borchero%2Fzeus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265607094,"owners_count":23797076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T07:06:16.865Z","updated_at":"2025-07-17T12:37:39.213Z","avatar_url":"https://github.com/borchero.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zeus\n\nZeus is a very simple utility package for context-based logging. In its core, it provides syntactic\nsugar for associating a logger with `context.Context` objects and retrieving it from these\ncontexts.\n\nZeus uses the \"blazing-fast and structured\" logging library [zap](https://github.com/uber-go/zap)\nunder the hood. By not using `zap` directly, interfaces in your code become less dependent on the\nlogging library as you do not need to pass the logger around explicitly. Rather, the logger is\n\"silently\" attached to context objects which are deeply rooted in the Go language.\n\n## Installation\n\n```bash\ngo get github.com/borchero/zeus\n```\n\n## Logging Quickstart\n\n```go\nfunc main() {\n    // Ensures that all logs are flushed prior to program exit\n    defer zeus.Sync()\n\n    ctx := context.Background()\n    // You can obtain a global logger instance from *any* context object in your application!\n    logger := zeus.Logger(ctx)\n    logger.Debug(\"hello\")\n    // \u003e\u003e\u003e prints \"DEBUG   hello\"\n\n    // You can do structured logging by customizing the logger that is associated with a context.\n    // For example, you can give it a name...\n    ctx = zeus.WithName(ctx, \"test\")\n    zeus.Logger(ctx).Info(\"world\")\n    // \u003e\u003e\u003e prints \"INFO    test    world\"\n\n    // ...or add some fields to the logger.\n    ctx = zeus.WithFields(ctx, zap.String(\"name\", \"borchero\"))\n    zeus.Logger(ctx).Info(\"new world\")\n    // \u003e\u003e\u003e prints \"INFO    test    new world       {\"name\": \"borchero\"}\"\n}\n```\n\nNote that `zeus.Logger` always returns a `*zap.Logger` instance which allows Zeus to be equally\npowerful as `zap`.\n\n### Log Configuration\n\nIn the example above, you see that we can use a logger without explicitly creating one beforehand.\nThis logger can be customized either from environment variables (recommended) or from code.\n\nWhen using environment variables, you may set `GO_LOG` and `GO_LOG_FORMAT`. `GO_LOG` allows for\n`debug`, `info`, `warn`, `error`, and `fatal` (and their uppercase counterparts) while\n`GO_LOG_FORMAT` may be set to `human` or `json`. By default, Zeus uses the following configuration:\n\n- `GO_LOG=info`\n- `GO_LOG_FORMAT=human`\n\nWhen you need utmost customization, you can create your own `*zap.Logger` and attach it to a\ncontext via `zeus.WithLogger`. Be aware that such a logger is only available for the context passed\nto `zeus.WithLogger` and the context's descendents. `zeus.Sync` will not ensure that all logs\nmanaged by this logger are printed and you will need to call `Sync` on this logger yourself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborchero%2Fzeus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborchero%2Fzeus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborchero%2Fzeus/lists"}