X.Serilog.Sinks.Telegram
2.0.0
See the version list below for details.
dotnet add package X.Serilog.Sinks.Telegram --version 2.0.0
NuGet\Install-Package X.Serilog.Sinks.Telegram -Version 2.0.0
<PackageReference Include="X.Serilog.Sinks.Telegram" Version="2.0.0" />
paket add X.Serilog.Sinks.Telegram --version 2.0.0
#r "nuget: X.Serilog.Sinks.Telegram, 2.0.0"
// Install X.Serilog.Sinks.Telegram as a Cake Addin #addin nuget:?package=X.Serilog.Sinks.Telegram&version=2.0.0 // Install X.Serilog.Sinks.Telegram as a Cake Tool #tool nuget:?package=X.Serilog.Sinks.Telegram&version=2.0.0
X.Serilog.Sinks.Telegram
Table of Contents
Introduction
X.Serilog.Sinks.Telegram is an open-source Serilog sink that allows you to send log events to Telegram. It's a convenient way to integrate Telegram as a logging output, enabling you to receive important log information directly in your chat.
Features
Real-time Logging: The sink offers the ability to send log events to a Telegram channel in real-time, ensuring that you can stay up-to-date with your application's behavior and any issues as they arise.
Customizable Formatting: You have the flexibility to configure the format of log messages sent to the Telegram channel, allowing you to tailor them to your preferences and specific requirements.
Filtering: The sink supports filtering log events before they are dispatched to the Telegram channel, ensuring that only pertinent information is shared.
Asynchronous Sending: Log events are sent asynchronously to the Telegram channel, minimizing any potential impact on your application's performance.
Easy Configuration: Configuring the sink to work with your Telegram channel is straightforward, and you can find comprehensive information in the Configuration Wiki.
Getting Started
To begin using the X.Serilog.Sinks.Telegram sink, follow these steps:
- Install the Package: You can install the sink package from NuGet using the following command:
dotnet add package X.Serilog.Sinks.Telegram
- Configure the Sink: In your application's configuration, set up the Telegram sink with the appropriate settings. Here's an example configuration in C#:
var logger = new LoggerConfiguration()
.Telegram(config =>
{
config.Token = "your_telegram_bot_token";
config.ChatId = "your_chat_id";
config.BatchPostingLimit = 10;
config.Mode = LoggingMode.Logs;
config.FormatterConfiguration = new FormatterConfiguration
{
UseEmoji = true,
ReadableApplicationName = "MyTestApp",
IncludeException = true,
IncludeProperties = true
};
config.BatchEmittingRulesConfiguration = new BatchEmittingRulesConfiguration
{
// Batch Emitting rules configuration here...
};
config.LogFiltersConfiguration = new LogsFiltersConfiguration
{
ApplyLogFilters = true,
FiltersOperator = LogFiltersOperator.Or,
Filters = new List<IFilter> {
// Your filters here...
}
};
}, null, LogEventLevel.Debug)
.CreateLogger();
- Start Logging: Once the sink is configured, you can start logging using Serilog as you normally would. Log events will be sent to your Telegram channel.
For more detailed configuration options, please refer to the Configuration Wiki.
Examples
This repository includes a number of example projects that demonstrate how to use X.Serilog.Sinks.Telegram in various scenarios. These examples can be very helpful if you're just getting started or looking to use a specific feature.
You can find the examples in the following location: X.Serilog.Sinks.Telegram Examples
Contributing
Feel free to add any improvements you want via pull requests. All pull requests must be linked to an issue.
License
This project is licensed under the MIT Licensehttps://en.wikipedia.org/wiki/MIT_License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- Serilog (>= 3.0.1)
- Telegram.Bot (>= 19.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.