{"id":18554201,"url":"https://github.com/xdxiaodong/logrus-hook-caller","last_synced_at":"2025-10-10T09:06:16.866Z","repository":{"id":57488246,"uuid":"132344684","full_name":"xdxiaodong/logrus-hook-caller","owner":"xdxiaodong","description":"使用hook的方式让Logrus拥有输出日志时输出源代码所在文件和行号功能","archived":false,"fork":false,"pushed_at":"2018-05-10T10:21:05.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T22:47:03.633Z","etag":null,"topics":["caller","logrus","logrus-hook"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xdxiaodong.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":"2018-05-06T14:11:12.000Z","updated_at":"2020-05-18T09:15:00.000Z","dependencies_parsed_at":"2022-08-29T15:01:20.365Z","dependency_job_id":null,"html_url":"https://github.com/xdxiaodong/logrus-hook-caller","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xdxiaodong/logrus-hook-caller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdxiaodong%2Flogrus-hook-caller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdxiaodong%2Flogrus-hook-caller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdxiaodong%2Flogrus-hook-caller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdxiaodong%2Flogrus-hook-caller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xdxiaodong","download_url":"https://codeload.github.com/xdxiaodong/logrus-hook-caller/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdxiaodong%2Flogrus-hook-caller/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003389,"owners_count":26083579,"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-10-10T02:00:06.843Z","response_time":62,"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":["caller","logrus","logrus-hook"],"created_at":"2024-11-06T21:20:11.607Z","updated_at":"2025-10-10T09:06:16.847Z","avatar_url":"https://github.com/xdxiaodong.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Caller Hook for [Logrus](https://github.com/sirupsen/logrus) \u003cimg src=\"http://i.imgur.com/hTeVwmJ.png\" width=\"40\" height=\"40\" alt=\":walrus:\" class=\"emoji\" title=\":walrus:\" /\u003e\n\n使用hook的方式让Logrus拥有输出日志时输出源代码所在文件和行号功能\n\n## 示例\n\n### 默认\n\n```go\npackage main\n\nimport (\n    log \"github.com/sirupsen/logrus\"\n    caller \"github.com/xdxiaodong/logrus-hook-caller\"\n)\n\nfunc main() {\n    log.SetFormatter(new(log.JSONFormatter))\n    hook_caller := caller.NewHook(\u0026caller.CallerHookOptions{\n\t//DisabledField: true,\n\t//EnableFile: true,\n\t//EnableLine: true,\n\t//Flags:      caller.Llongfile,\n\t})\n    log.AddHook(hook_caller)\n    log.Info(\"hello world\")\n}\n```\n\n### 源文件完整路径\n\n```go\npackage main\n\nimport (\n    log \"github.com/sirupsen/logrus\"\n    caller \"github.com/xdxiaodong/logrus-hook-caller\"\n)\n\nfunc main() {\n    log.SetFormatter(new(log.JSONFormatter))\n    hook_caller := caller.NewHook(\u0026caller.CallerHookOptions{\n\tFlags:      caller.Llongfile,\n\t})\n    log.AddHook(hook_caller)\n    log.Info(\"hello world\")\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxdxiaodong%2Flogrus-hook-caller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxdxiaodong%2Flogrus-hook-caller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxdxiaodong%2Flogrus-hook-caller/lists"}