{"id":22796040,"url":"https://github.com/krasun/logrus2telegram","last_synced_at":"2025-04-19T12:46:40.681Z","repository":{"id":57644446,"uuid":"439920953","full_name":"krasun/logrus2telegram","owner":"krasun","description":"A Telegram bot hook for Logrus logging library in Go","archived":false,"fork":false,"pushed_at":"2022-01-09T12:45:21.000Z","size":18,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T11:23:29.413Z","etag":null,"topics":["go","golang","logging","logrus","logrus-go","logrus-helper","logrus-hook","logrus-wrappers","telegram-bot"],"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/krasun.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":"2021-12-19T17:05:35.000Z","updated_at":"2024-02-25T05:44:07.000Z","dependencies_parsed_at":"2022-08-30T05:12:17.226Z","dependency_job_id":null,"html_url":"https://github.com/krasun/logrus2telegram","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flogrus2telegram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flogrus2telegram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flogrus2telegram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasun%2Flogrus2telegram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krasun","download_url":"https://codeload.github.com/krasun/logrus2telegram/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249698274,"owners_count":21312173,"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","golang","logging","logrus","logrus-go","logrus-helper","logrus-hook","logrus-wrappers","telegram-bot"],"created_at":"2024-12-12T05:09:49.896Z","updated_at":"2025-04-19T12:46:40.665Z","avatar_url":"https://github.com/krasun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logrus2telegram\n\n[![Build](https://github.com/krasun/logrus2telegram/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/krasun/logrus2telegram/actions/workflows/build.yml)\n[![codecov](https://codecov.io/gh/krasun/logrus2telegram/branch/main/graph/badge.svg?token=8NU6LR4FQD)](https://codecov.io/gh/krasun/logrus2telegram)\n[![Go Report Card](https://goreportcard.com/badge/github.com/krasun/logrus2telegram)](https://goreportcard.com/report/github.com/krasun/logrus2telegram)\n[![GoDoc](https://godoc.org/https://godoc.org/github.com/krasun/logrus2telegram?status.svg)](https://godoc.org/github.com/krasun/logrus2telegram)\n\n`logrus2telegram` is a Telegram bot hook for [Logrus logging library](https://github.com/sirupsen/logrus) in Go.\n\n## Installation\n\nAs simple as:\n\n```\ngo get github.com/krasun/logrus2telegram\n```\n\n## Usage \n\n```go\npackage main\n\nimport (\n\tlog \"github.com/sirupsen/logrus\"\n\t\n\t\"github.com/krasun/logrus2telegram\"\n)\n\nfunc main() {\t\n\thook, err := logrus2telegram.NewHook(\n\t\t\u003ctoken\u003e, \n\t\t[]int64{\u003cchat identifier\u003e},\n\t\t// the levels of messages sent to Telegram\n\t\t// default: []log.Level{log.ErrorLevel, log.FatalLevel, log.PanicLevel, log.WarnLevel, log.InfoLevel}\t\tInfoLevel}\n\t\tlogrus2telegram.Levels(log.AllLevels),\n\t\t// the levels of messages sent to Telegram with notifications\n\t\t// default: []log.Level{log.ErrorLevel, log.FatalLevel, log.PanicLevel, log.WarnLevel, log.InfoLevel}\t\t\n\t\tlogrus2telegram.NotifyOn([]log.Level{log.PanicLevel, log.FatalLevel, log.ErrorLevel, log.InfoLevel}),\n\t\t// default: 3 * time.second\n\t\tlogrus2telegram.RequestTimeout(10*time.Second),\n\t\t// default: entry.String() time=\"2021-12-22T14:48:56+02:00\" level=debug msg=\"example\"\n\t\tlogrus2telegram.Format(func(e *log.Entry) (string, error) {\n\t\t\treturn fmt.Sprintf(\"%s %s\", strings.ToUpper(e.Level.String()), e.Message), nil\n\t\t}),\n\t)\n\tif err != nil {\n\t\t// ...\n\t}\n\tlog.AddHook(hook)\n```\n\n## Tests \n\nTo make sure that the code is fully tested and covered:\n\n```\n$ go test .\nok  \tgithub.com/krasun/logrus2telegram\t0.470s\n```\n\n## Known Usages \n\n...\n\n## License \n\n**logrus2telegram** is released under [the MIT license](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrasun%2Flogrus2telegram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrasun%2Flogrus2telegram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrasun%2Flogrus2telegram/lists"}