асинхронно по-умолчанию

This commit is contained in:
2025-07-04 11:27:02 +03:00
parent 6011b9f200
commit 7d03f7280c
5 changed files with 45 additions and 42 deletions
+6 -10
View File
@@ -1,18 +1,16 @@
# Telegram Logrus Hook
This hook emits log messages (and corresponding fields) to the Telegram API for [logrus](https://git.company.lan/gopkg/logrus).
Этот хук для [logrus](https://git.company.lan/gopkg/logrus) отправляет сообщения журнала (и соответствующие поля) в Telegram API.
## Installation
## Установка
Install the package with:
Установить пакет командой:
```
go get git.company.lan/gopkg/telegramhook
```
## Usage
See the tests for working examples. Also:
## Использование
```go
import (
@@ -27,9 +25,8 @@ func main() {
"MyCoolApp",
"MYTELEGRAMTOKEN",
"@mycoolusername",
telegramhook.WithAsync(true),
telegramhook.WithTimeout(30 * time.Second),
telegramhook.WithLevel(logrus.ErrorLevel),
telegramhook.WithTimeout(30 * time.Second),
)
if err != nil {
log.Fatalf("Encountered error when creating Telegram hook: %s", err)
@@ -43,7 +40,7 @@ func main() {
}
```
Also you can set custom http.Client to use SOCKS5 proxy for example
Вы также можете использовать настроенный http.Client, например, использующий SOCKS5-прокси:
```go
import (
@@ -73,7 +70,6 @@ func main() {
"MYTELEGRAMTOKEN",
"@mycoolusername",
httpClient,
telegramhook.WithAsync(true),
telegramhook.WithTimeout(30 * time.Second),
)
if err != nil {