{"id":22870317,"url":"https://github.com/berquerant/logger","last_synced_at":"2025-03-31T11:26:15.258Z","repository":{"id":61624531,"uuid":"538989555","full_name":"berquerant/logger","owner":"berquerant","description":"A light-weight wrapper of standard log.","archived":false,"fork":false,"pushed_at":"2022-11-07T13:58:12.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T16:58:47.724Z","etag":null,"topics":["go"],"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/berquerant.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":"2022-09-20T12:57:06.000Z","updated_at":"2022-09-20T12:59:10.000Z","dependencies_parsed_at":"2023-01-22T11:45:41.588Z","dependency_job_id":null,"html_url":"https://github.com/berquerant/logger","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Flogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Flogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Flogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Flogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berquerant","download_url":"https://codeload.github.com/berquerant/logger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246460338,"owners_count":20781100,"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"],"created_at":"2024-12-13T13:14:31.456Z","updated_at":"2025-03-31T11:26:15.234Z","avatar_url":"https://github.com/berquerant.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logger\n\nA light-weight wrapper of standard `log`.\n\n## Static logger\n\n``` go\nlogger.G().Info(\"message\")\n```\n\nwrites like `2022/09/20 10:00:00 I | message` to stderr.\n\n## Logger instance\n\n``` go\nl := logger.NewDefault(logger.Lerror)\nl.Info(\"message\")\n```\n\n## Customized logger\n\n``` go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/berquerant/logger\"\n)\n\nfunc main() {\n\tlog.SetFlags(0)\n\tlog.SetOutput(os.Stdout)\n\tl := \u0026logger.Logger{\n\t\tProxy: logger.NewProxy(\n\t\t\tlogger.MustNewMapperFunc(func(ev logger.Event) logger.Event {\n\t\t\t\tswitch ev.Level() {\n\t\t\t\tcase logger.Linfo, logger.Lwarn, logger.Lerror:\n\t\t\t\t\t// select info, warn, error\n\t\t\t\t\treturn ev\n\t\t\t\tdefault:\n\t\t\t\t\t// ignore other levels\n\t\t\t\t\tfmt.Printf(\"Ignore: %v\", ev)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}).Next(func(ev logger.Event) {\n\t\t\t\tif ev.Level() == logger.Lerror { // consume only error logs\n\t\t\t\t\tfmt.Printf(\"Got an error: %v\\n\", ev)\n\t\t\t\t}\n\t\t\t}).Next(logger.StandardLogConsumer),\n\t\t),\n\t}\n\tl.Info(\"info msg\")\n\tl.Error(\"error msg\")\n\tl.Trace(\"trace msg\")\n}\n// Output:\n// info msg\n// Got an error: error msg\n// error msg\n// Ignore: trace msg\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Flogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberquerant%2Flogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Flogger/lists"}