Skip to content

This is a sink for the Serilog logger that allows you to log just to your Telegram. For you're convenience this sink can format logs as a summary of events that happened during a period

License

Notifications You must be signed in to change notification settings

Bardin08/X.Serilog.Sinks.Telegram

Repository files navigation

X.Serilog.Sinks.Telegram

Build status

NuGet NuGet Downloads

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 can 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 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:

  1. Install the Package: You can install the sink package from NuGet using the following command:
dotnet add package X.Serilog.Sinks.Telegram
  1. Configure the Sink: Set up the Telegram sink with the appropriate settings in your application's configuration. Here's an example configuration in C#:
Log.Logger = new LoggerConfiguration()
    .WriteTo.TelegramCore(
        token: botToken,
        chatId: loggingChatId,
        logLevel: LogEventLevel.Verbose)
    .WriteTo.Console()
    .CreateLogger();
  1. Start Logging: Once the sink is configured, you can log in using Serilog as usual. Log events will be sent to your Telegram channel.

For more detailed configuration options, please refer to the Configuration Wiki.

Examples

This repository includes several example projects that demonstrate how to use X.Serilog.Sinks.Telegram in various scenarios. These examples can be helpful if you're starting 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.

About

This is a sink for the Serilog logger that allows you to log just to your Telegram. For you're convenience this sink can format logs as a summary of events that happened during a period

Topics

Resources

License

Stars

Watchers

Forks

Languages