{"id":28441159,"url":"https://github.com/allisson/go-loglevel","last_synced_at":"2025-09-01T05:35:37.533Z","repository":{"id":57605946,"uuid":"210447408","full_name":"allisson/go-loglevel","owner":"allisson","description":"Simple implementation of logs with level filter.","archived":false,"fork":false,"pushed_at":"2019-09-24T14:00:13.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-20T04:33:15.085Z","etag":null,"topics":["golang","log","logger","logging"],"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/allisson.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":"2019-09-23T20:35:09.000Z","updated_at":"2019-09-26T18:56:19.000Z","dependencies_parsed_at":"2022-09-26T20:01:58.165Z","dependency_job_id":null,"html_url":"https://github.com/allisson/go-loglevel","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/allisson/go-loglevel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisson%2Fgo-loglevel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisson%2Fgo-loglevel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisson%2Fgo-loglevel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisson%2Fgo-loglevel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allisson","download_url":"https://codeload.github.com/allisson/go-loglevel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisson%2Fgo-loglevel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273077227,"owners_count":25041358,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","log","logger","logging"],"created_at":"2025-06-06T04:09:02.683Z","updated_at":"2025-09-01T05:35:37.508Z","avatar_url":"https://github.com/allisson.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-loglevel\n[![Build Status](https://travis-ci.org/allisson/go-loglevel.svg)](https://travis-ci.org/allisson/go-loglevel)\n[![Go Report Card](https://goreportcard.com/badge/github.com/allisson/go-loglevel)](https://goreportcard.com/report/github.com/allisson/go-loglevel)\n[![Documentation](https://godoc.org/github.com/allisson/go-loglevel?status.svg)](http://godoc.org/github.com/allisson/go-loglevel)\n\nSimple implementation of logs with level filter.\n\n## About\n\nThis is a super simple implementation of logs with level filter using only the stdlib.\n\nIf you need something more advanced, I recommend these other libs:\n\n- [zap](https://github.com/uber-go/zap)\n- [logrus](https://github.com/sirupsen/logrus)\n\n## How to use\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/allisson/go-loglevel\"\n)\n\nvar (\n\tsimpleLogger *loglevel.Logger\n\tjsonLogger   *loglevel.Logger\n)\n\nfunc init() {\n    \t// Get level from LOG_LEVEL envvar\n\tlevel := loglevel.LevelFromEnv()\n\tsimpleLogger = loglevel.NewLogger(os.Stdout, \"\", log.LstdFlags, level, loglevel.NewSimpleFormatter())\n\tjsonLogger = loglevel.NewLogger(os.Stdout, \"\", log.LstdFlags, level, loglevel.NewJSONFormatter())\n}\n\nfunc main() {\n\tsimpleLogger.Info(\"Info Message\", loglevel.Field(\"key-1\", \"value-1\"), loglevel.Field(\"key-2\", \"value-2\"))\n\t// output: 2019/09/23 17:33:02 INFO Info Message key-1=value-1 key-2=value-2\n\tjsonLogger.Info(\"Info Message\", loglevel.Field(\"key-1\", \"value-1\"), loglevel.Field(\"key-2\", \"value-2\"))\n\t// output: 2019/09/23 17:33:02 INFO Info Message {\"key-1\":\"value-1\",\"key-2\":\"value-2\"}\n}\n```\n\n```bash\ngo run example/main.go\n2019/09/23 17:50:01 INFO Info Message key-1=value-1 key-2=value-2\n2019/09/23 17:50:01 INFO Info Message {\"key-1\":\"value-1\",\"key-2\":\"value-2\"}\n```\n\n```bash\nLOG_LEVEL=CRITICAL go run example/main.go # don't show anything\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallisson%2Fgo-loglevel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallisson%2Fgo-loglevel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallisson%2Fgo-loglevel/lists"}