{"id":24638256,"url":"https://github.com/miyamo2/altnrslog","last_synced_at":"2026-02-24T01:31:44.657Z","repository":{"id":224618813,"uuid":"763697296","full_name":"miyamo2/altnrslog","owner":"miyamo2","description":"alternative library for \"New Relic Logs in Context\" with log/slog.","archived":false,"fork":false,"pushed_at":"2024-10-28T20:13:48.000Z","size":49,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-01T14:46:41.426Z","etag":null,"topics":["go","golang","newrelic","slog"],"latest_commit_sha":null,"homepage":"","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/miyamo2.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}},"created_at":"2024-02-26T19:00:22.000Z","updated_at":"2025-11-19T11:41:42.000Z","dependencies_parsed_at":"2024-03-22T04:28:30.067Z","dependency_job_id":"a0baea6a-d012-4bde-ae81-5fa085388bad","html_url":"https://github.com/miyamo2/altnrslog","commit_stats":null,"previous_names":["miyamo2/altnrslog"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/miyamo2/altnrslog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Faltnrslog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Faltnrslog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Faltnrslog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Faltnrslog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miyamo2","download_url":"https://codeload.github.com/miyamo2/altnrslog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyamo2%2Faltnrslog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29766299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T01:28:30.166Z","status":"ssl_error","status_checked_at":"2026-02-24T01:28:27.518Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["go","golang","newrelic","slog"],"created_at":"2025-01-25T10:13:32.812Z","updated_at":"2026-02-24T01:31:44.642Z","avatar_url":"https://github.com/miyamo2.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# altnrslog\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/miyamo2/altnrslog.svg)](https://pkg.go.dev/github.com/miyamo2/altnrslog)\n[![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/miyamo2/altnrslog?logo=go\u0026style=flat-square)](https://img.shields.io/github/go-mod/go-version/miyamo2/altnrslog?logo=go\u0026style=flat-square)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/miyamo2/altnrslog?style=flat-square)](https://img.shields.io/github/v/release/miyamo2/altnrslog?style=flat-square)\n[![codecov](https://codecov.io/gh/miyamo2/altnrslog/graph/badge.svg?token=GLLLYODW45)](https://codecov.io/gh/miyamo2/altnrslog)\n[![Go Report Card](https://goreportcard.com/badge/github.com/miyamo2/altnrslog)](https://goreportcard.com/report/github.com/miyamo2/altnrslog)\n[![GitHub License](https://img.shields.io/github/license/miyamo2/altnrslog?style=flat-square\u0026color=blue)](https://img.shields.io/github/license/miyamo2/altnrslog?style=flat-square\u0026color=blue)\n\naltnrslog is an alternative library for [_New Relic Logs in Context_](https://docs.newrelic.com/docs/logs/logs-context/logs-in-context/) with `log/slog`.\n\naltnrslog can also forward `slog.Attr` even only APM Agent.\n\n## Roadmap to release stable version\n\n- [ ] Transaction Scope\n  - [x] Supports Logs in Context with APM Agent\n  - [ ] Supports Logs in Context without APM Agent\n- [ ] ~Application Scope~ **CANCELED** [#32](https://github.com/miyamo2/altnrslog/issues/32)\n  - [ ] ~Supports Logs in Context with APM Agent~\n  - [ ] ~Supports Logs in Context without APM Agent~\n\n## Getting started\n\n### Installation\n\n```sh\ngo get github.com/miyamo2/altnrslog\n```\n\n### Simple Usage\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"github.com/miyamo2/altnrslog\"\n\t\"github.com/newrelic/go-agent/v3/newrelic\"\n\t\"log\"\n\t\"log/slog\"\n\t\"net/http\"\n\t\"os\"\n)\n\ntype IntroduceRequest struct {\n\tName string `json:\"name\"`\n}\n\nfunc main() {\n\tnr, err := newrelic.NewApplication(\n\t\tnewrelic.ConfigAppName(os.Getenv(\"NEW_RELIC_CONFIG_APP_NAME\")),\n\t\tnewrelic.ConfigLicense(os.Getenv(\"NEW_RELIC_CONFIG_LICENSE\")),\n\t\tnewrelic.ConfigAppLogForwardingEnabled(true),\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\thttp.HandleFunc(newrelic.WrapHandleFunc(nr, \"/introduce\", func(w http.ResponseWriter, r *http.Request) {\n\t\tctx := r.Context()\n\t\ttx := newrelic.FromContext(ctx)\n\t\tlogHandler := altnrslog.NewTransactionalHandler(nr, tx)\n\t\tlogger := slog.New(logHandler)\n\n\t\tvar req IntroduceRequest\n\t\tif err := json.NewDecoder(r.Body).Decode(\u0026req); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\tlogger.InfoContext(ctx, \"START\", slog.Group(\"request\", slog.String(\"name\", req.Name)))\n\n\t\tresponse := fmt.Sprintf(\"Hello, %s!\", req.Name)\n\t\tdefer logger.InfoContext(ctx, \"END\", slog.String(\"response\", response))\n\n\t\tw.Write([]byte(response))\n\t}))\n\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n\n```\n\n## Contributing\n\nFeel free to open PR or an Issue.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyamo2%2Faltnrslog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiyamo2%2Faltnrslog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyamo2%2Faltnrslog/lists"}