All Projects → adriankumpf → Logger Telegram Backend

adriankumpf / Logger Telegram Backend

Licence: mit
A logger backend for Telegram

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Logger Telegram Backend

checkmk-telegram-notify
Get alerted by Check_MK via Telegram bash script
Stars: ✭ 28 (+115.38%)
Mutual labels:  telegram, telegram-bot-api
Telegram
Telegram Bot API Wrapper for Scala
Stars: ✭ 310 (+2284.62%)
Mutual labels:  telegram-bot-api, telegram
Telegram Bot Swift
Telegram Bot SDK for Swift (unofficial)
Stars: ✭ 275 (+2015.38%)
Mutual labels:  telegram-bot-api, telegram
Python Telegram
Python client for the Telegram's tdlib
Stars: ✭ 246 (+1792.31%)
Mutual labels:  telegram-bot-api, telegram
Informer
A Telegram Mass Surveillance Bot in Python
Stars: ✭ 745 (+5630.77%)
Mutual labels:  telegram-bot-api, telegram
Telegrammer
Telegram Bot - written with Swift 5.2 / NIO, supports Linux, macOS
Stars: ✭ 248 (+1807.69%)
Mutual labels:  telegram-bot-api, telegram
Laravel Social Auto Posting
🌈Laravel social auto posting
Stars: ✭ 306 (+2253.85%)
Mutual labels:  telegram-bot-api, telegram
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+16915.38%)
Mutual labels:  telegram-bot-api, telegram
Teloxide
📮 An elegant Telegram bots framework for Rust
Stars: ✭ 604 (+4546.15%)
Mutual labels:  telegram-bot-api, telegram
Pytelegrambotapi
Python Telegram bot api.
Stars: ✭ 4,986 (+38253.85%)
Mutual labels:  telegram-bot-api, telegram
Yii2 Telegram Log
Telegram log target for Yii 2
Stars: ✭ 24 (+84.62%)
Mutual labels:  telegram, logging
Telegraphist
🤖 Telegram Bot API on Go
Stars: ✭ 16 (+23.08%)
Mutual labels:  telegram-bot-api, telegram
Rastreiobot
Telegram Bot @RastreioBot
Stars: ✭ 196 (+1407.69%)
Mutual labels:  telegram-bot-api, telegram
webhook-aiogram-heroku
A sample telegram bot made with aiogram, that fetches updates using the web-hook connection. Can be easily deployed to Heroku.
Stars: ✭ 36 (+176.92%)
Mutual labels:  telegram, telegram-bot-api
Java Telegram Bot Tutorial
Java Telegram Bot Tutorial. Feel free to submit issue if you found a mistake.
Stars: ✭ 165 (+1169.23%)
Mutual labels:  telegram-bot-api, telegram
Telegram.bot.examples
Examples for the Telegram.Bot C# Library
Stars: ✭ 290 (+2130.77%)
Mutual labels:  telegram-bot-api, telegram
Telegram.bot
.NET Client for Telegram Bot API
Stars: ✭ 1,964 (+15007.69%)
Mutual labels:  telegram-bot-api, telegram
Teledart
A Dart library interfacing with the latest Telegram Bot API.
Stars: ✭ 142 (+992.31%)
Mutual labels:  telegram-bot-api, telegram
Kotlin Telegram Bot
🤖 A wrapper for the Telegram Bot API written in Kotlin
Stars: ✭ 337 (+2492.31%)
Mutual labels:  telegram-bot-api, telegram
Java Telegram Bot Api
Telegram Bot API for Java
Stars: ✭ 819 (+6200%)
Mutual labels:  telegram-bot-api, telegram

LoggerTelegramBackend

A logger backend for Telegram.

Installation

Add :logger_telegram_backend to your list of dependencies in mix.exs:

def deps do
  [{:logger_telegram_backend, "~> 1.3"}]
end

Configuration

First of all you need to create a Telegram bot. Follow the instructions here to create one and get the token for the bot. Since bots are not allowed to contact users, you need to send a message first. Afterwards, retrieve your chat_id with $ curl -X GET https://api.telegram.org/botYOUR_TOKEN/getUpdates.

Then add LoggerTelegramBackend to the :backends configuration, configure the telegram chat_id and bot token:

config :logger, backends: [LoggerTelegramBackend, :console]

config :logger, :telegram,
  chat_id: "$chatId",
  token: "$botToken"

The logger configuration is read at runtime from the application environment so that you can provide it via distillerys dynamic configuration with environment variables.

Options

The following options are available:

  • :level - the level to be logged by this backend (either :debug, :info, :warn or :error). Note that messages are filtered by the general :level configuration for the :logger application first. If not explicitly configured all levels are logged.
  • :metadata - the metadata to be included in the telegram message. Defaults to [:line, :function, :module, :application, :file]. Setting :metadata to :all gets all metadata.
  • :metadata_filter - the metadata which is required in order for a message to be logged. Example: metadata_filter: [application: :ui].
  • :proxy - connect via an HTTP tunnel or a socks5 proxy (only available when using :hackney). See the hackney docs for further information.
  • :http_client - explicitly select the HTTP client (either LoggerTelegramBackend.HTTPClient.Hackney or LoggerTelegramBackend.HTTPClient.Mint). Picks either of which is installed as transitive or direct dependency.

Examples

With Metadata Filter
config :logger, :telegram,
  chat_id: "$chatId",
  token: "$botToken",
  level: :info,
  metadata: :all
  metadata_filter: [application: :ui]
With Proxy
config :logger, :telegram,
  chat_id: "$chatId",
  token: "$botToken",
  proxy: "socks5://127.0.0.1:9050"

Multiple logger handlers

Like the LoggerFileBackend multiple logger handlers may be configured, each with different :chat_ids, :levels etc. Each handler has to be configured as a separate logger backend:

config :logger,
  backends: [
    {LoggerTelegramBackend, :telegram_filter},
    {LoggerTelegramBackend, :telegram_level},
    :console
  ]

config :logger, :telegram_filter,
  chat_id: "$chatId",
  token: "$botToken",
  metadata_filter: [application: :ui],
  metadata: [:line, :function, :module, :pid]

config :logger, :telegram_level,
  chat_id: "$chatId",
  token: "$botToken",
  level: :warn
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].