{"id":38746113,"url":"https://github.com/rafaelespinoza/logg","last_synced_at":"2026-01-17T11:45:43.643Z","repository":{"id":57631239,"uuid":"409041502","full_name":"rafaelespinoza/logg","owner":"rafaelespinoza","description":"Structured logging library with simple API","archived":false,"fork":false,"pushed_at":"2025-11-11T05:13:08.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-11T05:26:57.050Z","etag":null,"topics":["golang","logging","slog","structured-logging"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/rafaelespinoza/logg","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/rafaelespinoza.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-09-22T02:39:11.000Z","updated_at":"2025-11-03T16:17:04.000Z","dependencies_parsed_at":"2025-10-24T06:12:06.220Z","dependency_job_id":"1156431d-8b15-45c1-b965-c68f10688023","html_url":"https://github.com/rafaelespinoza/logg","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rafaelespinoza/logg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelespinoza%2Flogg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelespinoza%2Flogg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelespinoza%2Flogg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelespinoza%2Flogg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rafaelespinoza","download_url":"https://codeload.github.com/rafaelespinoza/logg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafaelespinoza%2Flogg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T10:25:30.148Z","status":"ssl_error","status_checked_at":"2026-01-17T10:25:29.718Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["golang","logging","slog","structured-logging"],"created_at":"2026-01-17T11:45:43.014Z","updated_at":"2026-01-17T11:45:43.635Z","avatar_url":"https://github.com/rafaelespinoza.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"```\n __        ______     _______   _______\n|  |      /  __  \\   /  _____| /  _____|\n|  |     |  |  |  | |  |  __  |  |  __\n|  |     |  |  |  | |  | |_ | |  | |_ |\n|  `----.|  `--'  | |  |__| | |  |__| |\n|_______| \\______/   \\______|  \\______|\n```\n\n[![](https://github.com/rafaelespinoza/logg/workflows/build/badge.svg)](https://github.com/rafaelespinoza/logg/actions)\n[![](https://pkg.go.dev/badge/github.com/rafaelespinoza/logg)](https://pkg.go.dev/github.com/rafaelespinoza/logg)\n[![codecov](https://codecov.io/gh/rafaelespinoza/logg/branch/main/graph/badge.svg?token=GFUSTO55PY)](https://codecov.io/gh/rafaelespinoza/logg)\n\nPackage logg is a thin wrapper around log/slog. The primary goal is to leverage\nall the things offered by that package, but also make it easier to separate\napplication metadata from event-specific data. It's opinionated and offers a\nlimited feature set.\n\nThe feature set is:\n\n- It's `log/slog` with light attribute management. After package setup,\n  attributes and groups added to a logger via `slog.Logger.With` or\n  `slog.Logger.WithGroup` are placed under a pre-built group. Attributes passed\n  to a log output method are also placed under this group.\n- Pass in a `slog.Handler` for further customization.\n\n## Usage\n\nCall the `SetDefaults` function as early as possible in your application. This\ninitializes a root logger, which functions like a prototype for subsequent\nevents. Things initialized are the output sinks and an optional\n`\"application_metadata\"` field. The data appears in its own group for each log\nevent.\n\nTo add more event-specific fields to a logging entry, call `New`. This function\ncreates a `slog.Logger` with an optional trace ID and optional data attributes.\nAttributes, including group attributes, added through the logger methods, would\nbe applied to one pre-built group attribute.\n\nSee more in the godoc examples.\n\n## Event shape\n\nWhen using the `slog.JSONHandler` with default settings, these top-level fields\nare present:\n\n- `time`: string, rfc3339 timestamp.\n- `level`: string, sometimes this is called \"severity\". One of: `\"DEBUG\"`,\n  `\"INFO\"`,`\"WARN\"`, `\"ERROR\"`.\n- `msg`: string, what happened.\n\nThese top-level fields may or may not be present, depending on configuration and\nhow the event is emitted:\n- `application_metadata`: map[string]any, optional versioning metadata from\n  your application. Will only be present when this data is passed in to the\n  `SetDefaults` function.\n- `trace_id`: string, a tracing ID. Present when a non-empty value is passed\n  into the `New` function.\n- `data`: map[string]any, other event-specific fields.\n\n### Example events\n\nThese examples use the `slog.Handler` implementation `slog.JSONHandler`.\n\nInfo level\n```\n{\n  \"time\":\"2025-09-22T08:59:52.657053724Z\",\n  \"level\":\"INFO\",\n  \"msg\":\"TestLogger\",\n  \"data\":{\n    \"alfa\": \"anything\",\n    \"bravo\": {\n      \"bool\": true,\n      \"duration_ns\": 1234,\n      \"float\": 1.23,\n      \"int\": 10,\n      \"string\": \"nevada\"\n    }\n  }\n}\n```\n\nVersioning metadata can be added with the `SetDefaults` function.\n```\n{\n  \"time\":\"2025-09-22T08:59:52.347111271Z\",\n  \"level\":\"INFO\",\n  \"msg\":\"TestLogger\",\n  \"application_metadata\":{\n    \"branch_name\":\"main\",\n    \"go_version\":\"v1.25\",\n    \"commit_hash\":\"deadbeef\"\n  },\n  \"data\":{\n    \"alfa\": \"anything\",\n    \"bravo\": {\n      \"bool\": true,\n      \"duration_ns\": 1234,\n      \"float\": 1.23,\n      \"int\": 10,\n      \"string\": \"nevada\"\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaelespinoza%2Flogg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafaelespinoza%2Flogg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaelespinoza%2Flogg/lists"}