{"id":40047982,"url":"https://github.com/va-slyusarev/lgr","last_synced_at":"2026-01-19T05:37:38.171Z","repository":{"id":57536460,"uuid":"184893072","full_name":"va-slyusarev/lgr","owner":"va-slyusarev","description":"Another implementation of the logger with levels.","archived":false,"fork":false,"pushed_at":"2019-05-13T13:14:25.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-07-07T10:31:26.188Z","etag":null,"topics":["log","logger","logging"],"latest_commit_sha":null,"homepage":null,"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/va-slyusarev.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-05-04T12:40:04.000Z","updated_at":"2019-05-13T13:14:27.000Z","dependencies_parsed_at":"2022-08-29T00:50:15.675Z","dependency_job_id":null,"html_url":"https://github.com/va-slyusarev/lgr","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/va-slyusarev/lgr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/va-slyusarev%2Flgr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/va-slyusarev%2Flgr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/va-slyusarev%2Flgr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/va-slyusarev%2Flgr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/va-slyusarev","download_url":"https://codeload.github.com/va-slyusarev/lgr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/va-slyusarev%2Flgr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28561902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"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":["log","logger","logging"],"created_at":"2026-01-19T05:37:37.413Z","updated_at":"2026-01-19T05:37:38.162Z","avatar_url":"https://github.com/va-slyusarev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lgr\nAnother implementation of the logger with levels.\n\n## Install\n\n```sh\ngo get github.com/va-slyusarev/lgr\n```\n\n## Levels\nIn total 4 levels of logging are used:\n```go\n// Levels.\nconst (\n\tDEBUG = \"DEBUG\"\n\tINFO  = \"INFO\"\n\tWARN  = \"WARN\"\n\tERROR = \"ERROR\"\n)\n```\n\nEach level has a priority, and if the current level is higher in priority than the priority of the message, it will not be printed.\n\n## Format\nThe format of the output messages can be configured using the template `text/template`.\nThere are 4 predefined templates:\n\n```go\nconst (\n\tXSmallTpl = `{{ if .Prefix }}{{ printf \"%s: \" .Prefix }}{{ end }}{{ .Message }}`\n\tSmallTpl  = `{{ printf \"[%-5s] \" .Level }}{{ if .Prefix }}{{ printf \"%s: \" .Prefix }}{{ end }}{{ .Message }}`\n\tMediumTpl = `{{.TS.Format \"2006/01/02 15:04:05\" }} {{ printf \"[%-5s] \" .Level }}{{ if .Prefix }}{{ printf \"%s: \" .Prefix }}{{ end }}{{ .Message }}`\n\tLargeTpl  = `{{.TS.Format \"2006/01/02 15:04:05.000\" }} {{ printf \"[%-5s] \" .Level }}{{ printf \"{%s} \" .Caller }}{{ if .Prefix }}{{ printf \"%s: \" .Prefix }}{{ end }}{{ .Message }}`\n)\n```\n\nStandard templates have aliases for use as flag parameters:\n - **XSmallTpl** - `XSmallTpl` or `xs`\n - **SmallTpl** - `SmallTpl` or `sm`\n - **MediumTpl** - `MediumTpl` or `md`\n - **LargeTpl** - `LargeTpl` or `lg`\n \n\n## Use case\n\n```go\npackage main\n\nimport (\n\t\"flag\"\n\n\t\"github.com/va-slyusarev/lgr\"\n)\n\nvar message = flag.String(\"msg\", \"hello lgr!\", \"Logger message.\")\n\nfunc main() {\n\tflag.Var(lgr.Std.Level, \"l\", \"Logger level.\")\n\tflag.Var(lgr.Std.Prefix, \"p\", \"Logger prefix.\")\n\tflag.Var(lgr.Std.Template, \"t\", \"Logger template.\")\n\tflag.Parse()\n\n\tlgr.Debug(*message)\n\tlgr.Info(*message)\n\tlgr.Warn(*message)\n\tlgr.Error(*message)\n}\n```\n\nRun\n\n```sh\n go run main.go -l=WARN -p=ex -t=lg\n```\n\nYou'll see something like this\n\n```sh\n2006/01/02 15:04:05.000 [WARN ] {_example/test.go:19} ex: hello lgr!\n2006/01/02 15:04:05.000 [ERROR] {_example/test.go:20} ex: hello lgr!\n```\n\n\nSee `_example`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fva-slyusarev%2Flgr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fva-slyusarev%2Flgr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fva-slyusarev%2Flgr/lists"}