асинхронно по-умолчанию
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user