Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cyrus-sushiant/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 6.0 or above
https://github.com/cyrus-sushiant/serilog.sinks.telegrambot
logger logging serilog serilog-extension serilog-sink serilog-sink-telegram telegram telegram-bot telegram-bot-api
Last synced: 15 days ago
JSON representation
Serilog.Sinks.TelegramBot is a library to save logging information from Serilog to Telegram. The assembly was written and tested in .Net 6.0 or above
- Host: GitHub
- URL: https://github.com/cyrus-sushiant/serilog.sinks.telegrambot
- Owner: Cyrus-Sushiant
- License: mit
- Created: 2019-12-31T11:24:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-23T13:50:19.000Z (8 months ago)
- Last Synced: 2024-10-04T12:49:46.929Z (about 1 month ago)
- Topics: logger, logging, serilog, serilog-extension, serilog-sink, serilog-sink-telegram, telegram, telegram-bot, telegram-bot-api
- Language: C#
- Homepage: https://www.smartclouds.co
- Size: 139 KB
- Stars: 30
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serilog.Sinks.TelegramBot
[![NuGet Version](https://img.shields.io/nuget/v/Serilog.Sinks.TelegramBot.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.TelegramBot/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://raw.githubusercontent.com/Cyrus-Sushiant/Serilog.Sinks.TelegramBot/master/LICENSE)A Serilog sink that writes events as messages to [Telegram](https://telegram.org/).
All you need is bot token and chat id. To manage bots go to [Bot Father](https://telegram.me/botfather). 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
* .Net 6.0
* .Net 7.0
* .Net 8.0# Install
```
Install-Package Serilog.Sinks.TelegramBot
```## Basic usage:
```csharp
var log = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.TelegramBot("000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "000000")
.CreateLogger();
log.Information("This is an information message!");
```### Example
![Simple Message](/assets/example.png)