{"id":17436047,"url":"https://github.com/nicklasfrahm-dev/appkit","last_synced_at":"2025-03-28T01:21:45.048Z","repository":{"id":257804347,"uuid":"864664748","full_name":"nicklasfrahm-dev/appkit","owner":"nicklasfrahm-dev","description":"A set of useful libraries to quickly build a Go application.","archived":false,"fork":false,"pushed_at":"2024-12-07T14:17:34.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T03:18:00.946Z","etag":null,"topics":["go","library"],"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/nicklasfrahm-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2024-09-28T20:31:38.000Z","updated_at":"2024-12-07T14:17:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"f6d9104f-0e65-4618-8c34-bfa0b7919776","html_url":"https://github.com/nicklasfrahm-dev/appkit","commit_stats":null,"previous_names":["nicklasfrahm-dev/appkit"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicklasfrahm-dev%2Fappkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicklasfrahm-dev%2Fappkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicklasfrahm-dev%2Fappkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicklasfrahm-dev%2Fappkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicklasfrahm-dev","download_url":"https://codeload.github.com/nicklasfrahm-dev/appkit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245950522,"owners_count":20699085,"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":["go","library"],"created_at":"2024-10-17T10:01:44.767Z","updated_at":"2025-03-28T01:21:44.990Z","avatar_url":"https://github.com/nicklasfrahm-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# App Kit\n\nThis repository provides a set of useful libraries that can be used to quickly build a Go applications.\n\n```shell\ngo get github.com/nicklasfrahm-dev/appkit\n```\n\n## Logging\n\nThis package provides a simple logging library based on [zap][github-zap], which may be configured at runtime using the environment variables shown below. The logger is optimized for structured logging using [Loki][github-loki] as a log aggregation system. By default the logger will use a production-ready configuration, but it can be configured to output logs in a more human-readable format for development purposes.\n\n| Environment variable | Description                      | Default | Allowed values                            |\n| -------------------- | -------------------------------- | ------- | ----------------------------------------- |\n| `LOG_LEVEL`          | The minimum log level to output. | `info`  | `debug`, `info`, `warn`, `error`, `fatal` |\n| `LOG_FORMAT`         | The log format to use.           | `json`  | `json`, `console`                         |\n\n### Example\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/nicklasfrahm-dev/appkit/logging\"\n\t\"go.uber.org/zap\"\n)\n\nfunc main() {\n\tlogger := logging.NewLogger()\n\n\tport := 8080\n\n\t// Don't do this.\n\tlogger.Info(fmt.Sprintf(\"Starting HTTP server on port %d\", port))\n\tlogger.Sugar().Infof(\"Starting HTTP server on port %d\", port)\n\n\t// Do this instead.\n\tlogger.Info(\"Starting HTTP server\", zap.Int(\"port\", port))\n\n\tprintLog(logger)\n\n\t// This is how you can use a context to pass a logger around.\n\tctx := logging.WithLogger(context.Background(), logger)\n\tprintLogWithContext(ctx)\n\n\t// This is how you can add fields to the logger in the context.\n\tprintLogWithContext(logging.WithFields(ctx, zap.String(\"key\", \"value\")))\n}\n\n// This is how you can pass the logger around.\nfunc printLog(logger *zap.Logger) {\n\tlogger.Info(\"This is a log message\", zap.String(\"key\", \"value\"))\n}\n\n// This is how you can use a context to pass the logger around.\nfunc printLogWithContext(ctx context.Context) {\n\tlogger := logging.FromContext(ctx)\n\tlogger.Info(\"This is a log message\", zap.String(\"key\", \"value\"))\n}\n```\n\n## License\n\nThis project is and will always be licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for more information.\n\n[github-zap]: https://github.com/uber-go/zap\n[github-loki]: https://github.com/grafana/loki\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicklasfrahm-dev%2Fappkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicklasfrahm-dev%2Fappkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicklasfrahm-dev%2Fappkit/lists"}