{"id":37176205,"url":"https://github.com/go-slog-handler/slog-handler","last_synced_at":"2026-01-14T20:33:53.648Z","repository":{"id":217052112,"uuid":"743001038","full_name":"go-slog-handler/slog-handler","owner":"go-slog-handler","description":"Pretty handler for structured Logging with slog","archived":false,"fork":false,"pushed_at":"2025-11-30T14:22:32.000Z","size":309,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-02T21:04:20.634Z","etag":null,"topics":["golang","logger","logging","slog"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-slog-handler.png","metadata":{"files":{"readme":"docs/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":"2024-01-14T02:06:46.000Z","updated_at":"2025-11-30T14:19:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5fcc7c9-54f2-4793-8322-bd55342ad0ba","html_url":"https://github.com/go-slog-handler/slog-handler","commit_stats":null,"previous_names":["go-slog-handler/slog-handler"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/go-slog-handler/slog-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-slog-handler%2Fslog-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-slog-handler%2Fslog-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-slog-handler%2Fslog-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-slog-handler%2Fslog-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-slog-handler","download_url":"https://codeload.github.com/go-slog-handler/slog-handler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-slog-handler%2Fslog-handler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"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","logger","logging","slog"],"created_at":"2026-01-14T20:33:52.799Z","updated_at":"2026-01-14T20:33:53.639Z","avatar_url":"https://github.com/go-slog-handler.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pretty handler for structured Logging with slog\n\nThe handler is ready to use:\n```go\npackage main\n\nimport (\n\t\"log/slog\"\n\n\tlogger \"gopkg.in/slog-handler.v1\"\n)\n\nfunc main() {\n\tslog.Info(\"test\", \"example 1\", map[int]string{\n\t\t0: \"test\",\n\t})\n\tslog.Info(\"example of raw output\", \"raw;example 2\", map[int]string{\n\t\t0: \"test\",\n\t})\n\tslog.Error(\"example of raw output\", \"raw;example 3\", map[int]string{\n\t\t0: \"test\",\n\t})\n\tslog.Warn(\"test 2\", \"example 4\", map[int]string{\n\t\t0: \"test\",\n\t})\n}\n\nfunc init() {\n\tlogger.SetLogger(\n\t\tlogger.Options{\n\t\t\tAddSource: true,\n\t\t\tFormat:    \"text\",\n\t\t\tLevel:     \"debug\",\n\t\t\tPretty:    true,\n\t\t},\n\t)\n}\n```\n\nOutput:\n![handler output](output.png?raw=true)\n\n## NullHandler\n\nThe `NullHandler` is a special handler that discards all log records. It's useful for:\n- Testing where you don't want log output\n- Disabling logging in production without code changes\n- Benchmarking code without logging overhead\n\n### Usage\n\n```go\npackage main\n\nimport (\n\t\"log/slog\"\n\n\tlogger \"gopkg.in/slog-handler.v1\"\n)\n\nfunc main() {\n\t// Create logger with NullHandler\n\tlog := logger.NewLogger(logger.Options{\n\t\tNull: true, // Enable NullHandler\n\t})\n\n\t// These logs will be discarded\n\tlog.Info(\"this will not be logged\")\n\tlog.Error(\"this will also be discarded\")\n\tlog.With(\"key\", \"value\").Debug(\"nothing here\")\n}\n```\n\nYou can also set it as the global logger:\n\n```go\nfunc init() {\n\tlogger.SetGlobalLogger(logger.Options{\n\t\tNull: true, // All slog calls will be discarded\n\t})\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-slog-handler%2Fslog-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-slog-handler%2Fslog-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-slog-handler%2Fslog-handler/lists"}