azhe403 / Serilog.Sinks.TelegramBot

Serilog.Sinks.TelegramBot is a library to save logging information from Serilog to Telegram. The assembly was written and tested in .Net Core 3.1, .Net 5 & .Net 6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serilog.Sinks.TelegramBot

NuGet Version License: MIT

A Serilog sink that writes events as messages to Telegram.

All you need is bot token and chat id. To manage bots go to Bot Father. After you got bot token add bot to contacts and start it (/start). To get your id navigate to https://api.telegram.org/botTOKEN/getUpdates

Available for

  • .NetCore 3.1
  • .Net 5.0
  • .Net 6.0

Install

Install-Package Serilog.Sinks.TelegramBot

Basic usage:

var log = new LoggerConfiguration()
                .MinimumLevel.Verbose()
                .WriteTo.TelegramBot("000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "000000")
                .CreateLogger();
log.Information("This is an information message!");

Example

Simple Message

About

Serilog.Sinks.TelegramBot is a library to save logging information from Serilog to Telegram. The assembly was written and tested in .Net Core 3.1, .Net 5 & .Net 6

License:MIT License


Languages

Language:C# 100.0%