{"id":19337919,"url":"https://github.com/seipan/loghook","last_synced_at":"2025-04-23T01:31:08.523Z","repository":{"id":176967883,"uuid":"656118451","full_name":"seipan/loghook","owner":"seipan","description":"⚡ logger to notify logs to slack,discord using webhook ⚡","archived":false,"fork":false,"pushed_at":"2025-04-16T09:30:50.000Z","size":145,"stargazers_count":21,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-18T20:44:28.533Z","etag":null,"topics":["discord","go","golang","logger","slack","webhook"],"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/seipan.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":"2023-06-20T09:39:37.000Z","updated_at":"2025-04-16T09:30:52.000Z","dependencies_parsed_at":"2023-12-30T09:25:12.870Z","dependency_job_id":"383389ae-669e-4b30-9997-b4a7ca985455","html_url":"https://github.com/seipan/loghook","commit_stats":null,"previous_names":["seipan/loghook"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seipan%2Floghook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seipan%2Floghook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seipan%2Floghook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seipan%2Floghook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seipan","download_url":"https://codeload.github.com/seipan/loghook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250352228,"owners_count":21416459,"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":["discord","go","golang","logger","slack","webhook"],"created_at":"2024-11-10T03:15:48.084Z","updated_at":"2025-04-23T01:31:08.173Z","avatar_url":"https://github.com/seipan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![Last commit](https://img.shields.io/github/last-commit/seipan/loghook?style=flat-square)\n![Repository Stars](https://img.shields.io/github/stars/seipan/loghook?style=flat-square)\n![Issues](https://img.shields.io/github/issues/seipan/loghook?style=flat-square)\n![Open Issues](https://img.shields.io/github/issues-raw/seipan/loghook?style=flat-square)\n[![go](https://github.com/seipan/loghook/actions/workflows/go.yml/badge.svg)](https://github.com/seipan/loghook/actions/workflows/go.yml)\n[![codecov](https://codecov.io/gh/seipan/loghook/graph/badge.svg?token=OALYRHUB88)](https://codecov.io/gh/seipan/loghook)\n\n\u003cimg src=\"img/logo.png\" alt=\"eyecatch\" height=\"250\"\u003e\n\n# loghook\n\n⚡  logger to notify logs to slack,discord using webhook   ⚡\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n\u003c/div\u003e\n\n## Installation\n```\ngo get github.com/seipan/loghook\n```\n\n## Usage\nWhen using it, you need to obtain the default webhook for discord and the incoming webhook for slack in advance.\n```go\npackage discord\n\nimport \"github.com/seipan/loghook\"\n\nvar (\n\t// DiscordWebhookURL is a webhook url for discord.\n\tDiscordWebhookURL = \"https://discord.com/api/webhooks/xxxxxxxx/xxxxxxxx\"\n)\n\nfunc main() {\n\tlogger := loghook.NewLogger(\"\", \"test\", \"discord\", DiscordWebhookURL)\n\tlogger.SetLevel(loghook.DebugLevel)\n\tlogger.SetWebhook(DiscordWebhookURL)\n\n\tlogger.Debug(\"test\")\n\tlogger.Infof(\"test %s\", \"info\")\n}\n```\n\nIf you do not want to be notified of a particular log level, you can set\n```go\npackage discord\n\nimport \"github.com/seipan/loghook\"\n\nvar (\n\t// DiscordWebhookURL is a webhook url for discord.\n\tDiscordWebhookURL = \"https://discord.com/api/webhooks/xxxxxxxx/xxxxxxxx\"\n)\n\nfunc main(){\n\tlogger := loghook.NewLogger(\"\", \"test\", \"discord\", DiscordWebhookURL)\n\n\tlogger.NoSendDebug()\n\tlogger.Debug(\"test\")\n\tlogger.NoSendInfo()\n\tlogger.Infof(\"test %s\", \"info\")\n}\n```\nYou can also change the webhook to be notified for each log level\n```go\npackage discord\n\nimport \"github.com/seipan/loghook\"\n\nvar (\n\t// DiscordWebhookURL is a webhook url for discord.\n\tDiscordWebhookURL = \"https://discord.com/api/webhooks/xxxxxxxx/xxxxxxxx\"\n)\n\nfunc main(){\n\tlogger := loghook.NewLogger(\"\", \"test\", \"discord\", DiscordWebhookURL)\n\n\tlogger.SetErrorWebhook(DiscordErrorWebhookURL)\n\tlogger.Error(\"test\")\n}\n```\nThere is also a method that takes 'context' as an argument\n```go\npackage discord\n\nimport \"github.com/seipan/loghook\"\n\nvar (\n\t// DiscordWebhookURL is a webhook url for discord.\n\tDiscordWebhookURL = \"https://discord.com/api/webhooks/xxxxxxxx/xxxxxxxx\"\n)\n\nfunc main(){\n\tlogger := loghook.NewLogger(\"\", \"test\", \"discord\", DiscordWebhookURL)\n\n\tlogger.ErrorContext(\"test\")\n}\n```\nIf you want a more detailed example, please see the [examples](https://github.com/seipan/loghook/blob/main/example).\n## License\nCode licensed under \n[the MIT License](https://github.com/seipan/loghook/blob/main/LICENSE).\n\n## Author\n[seipan](https://github.com/seipan).\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=seipan/loghook\u0026type=Date)](https://star-history.com/#seipan/loghook\u0026Date)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseipan%2Floghook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseipan%2Floghook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseipan%2Floghook/lists"}