{"id":42555989,"url":"https://github.com/misho-kr/logrus-hooks","last_synced_at":"2026-01-28T19:42:19.976Z","repository":{"id":57606827,"uuid":"271200063","full_name":"misho-kr/logrus-hooks","owner":"misho-kr","description":"Logrus hooks with enhanced and reliable logging functionality","archived":false,"fork":false,"pushed_at":"2025-11-17T09:18:40.000Z","size":27,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-17T10:22:34.424Z","etag":null,"topics":["golang","hooks","logrus"],"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/misho-kr.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-10T06:45:28.000Z","updated_at":"2025-11-17T09:12:44.000Z","dependencies_parsed_at":"2024-06-20T12:11:40.240Z","dependency_job_id":null,"html_url":"https://github.com/misho-kr/logrus-hooks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/misho-kr/logrus-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misho-kr%2Flogrus-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misho-kr%2Flogrus-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misho-kr%2Flogrus-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misho-kr%2Flogrus-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/misho-kr","download_url":"https://codeload.github.com/misho-kr/logrus-hooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misho-kr%2Flogrus-hooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28850473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: 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":["golang","hooks","logrus"],"created_at":"2026-01-28T19:42:19.319Z","updated_at":"2026-01-28T19:42:19.970Z","avatar_url":"https://github.com/misho-kr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Smart Logrus Hooks\n==================\n\n[![GoDoc](https://godoc.org/github.com/misho-kr/logrus-hooks?status.svg)](https://godoc.org/github.com/misho-kr/logrus-hooks) [![Go Build](https://github.com/misho-kr/logrus-hooks/actions/workflows/go.yml/badge.svg)](https://github.com/misho-kr/logrus-hooks/actions/workflows/go.yml) [![codecov](https://codecov.io/gh/misho-kr/logrus-hooks/branch/master/graph/badge.svg)](https://codecov.io/gh/misho-kr/logrus-hooks)\n\n[Logrus](https://github.com/sirupsen/logrus) is a popular structured logger that allows to add hooks that are invoked for every message. These hooks can be used to send the messages to remote tracking and reporting system. Things may go wrong when talking to remote systems, like delays and errors.\n\nThe hooks from this package are [decorators](https://en.wikipedia.org/wiki/Decorator_pattern) that help to deal with:\n\n* Transient errors\n* Excessive logging messages\n* Slow transmission times\n\n### Setup\n\nThe examples will use the [syslog hook](https://github.com/sirupsen/logrus/tree/master/hooks/syslog) to send messages to _syslog_ daemon. The setup looks like this:\n\n```go\nimport (\n  \"log/syslog\"\n\n  \"github.com/misho-kr/logrus-hooks\"\n  \"github.com/sirupsen/logrus\"\n  lSyslog \"github.com/sirupsen/logrus/hooks/syslog\"\n)\n\nfunc init() {\n\n\t// create a hook to be added to an instance of logger\n\thook, err := NewSyslogHook(\"udp\", \"server.fqdn:514\", syslog.LOG_DEBUG, \"\")\n}\n```\n\nFrom here additional hooks can be added for enhanced logging functionality.\n\n### Retry with backoff\n\nPrevent transient errors from procesing the log messages with _retries_\n\n```go\nlog.AddHook(RetryHook(\n\thook,\n\t100 * time.Millisecond,  // delay between retries\n\thooks.Retries(3),        // retry 3 times\n\thooks.FactorPct(100),    // increase delay by 100% between retries\n\thooks.JitterPct(10),     // jitter of 10% to the delay between retries\n))\n```\n\n### Rate limits\n\nPut a cap on the number of logging messages per time interval\n\n```go\nlog.AddHook(RateLimitHook(\n\thook,\n\thooks.PerSecond(10),     // 10 messages per second\n\thooks.Burst(20),         // burst of 20 messages allowed\n))\n```\n\n### Asynchronous execution\n\nFire the hook in separate goroutine to avoid blocking the logger and main application\n\n```go\nlog.AddHook(AsyncHook(\n\thook,\n\thooks.Senders(10),       // 10 goroutines to send messages\n\thooks.BoostSenders(20),  // up to 20 additional goroutines when needed \n))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisho-kr%2Flogrus-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmisho-kr%2Flogrus-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisho-kr%2Flogrus-hooks/lists"}