Skip to content

.NET Core NLog target for Telegram with the available format which provided by Telegram. Available format: MARKDOWN HTML5

License

Notifications You must be signed in to change notification settings

sopheakmorm/NLog.Telegram.Format.Core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NLog.Telegram for .NET CORE

An NLog target for Telegram with the avaiable format which provided by Telgram. Available format: MARKDOWN HTML5 for more : https://core.telegram.org/bots/api#formatting-options

This repository referenced by : https://github.com/narfunikita/NLog.Telegram


Usage

  1. Create a TelegramBot(https://core.telegram.org/bots#3-how-do-i-create-a-bot).
  2. Configure NLog to use NLog.Telegram.Format.Core: https://github.com/nlog/nlog/wiki/Configuration-file

NLog.config

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <extensions>
    <add assembly="NLog.Telegram.Format.Core" />
  </extensions>

  <targets async="true">
    <target xsi:type="Telegram"
            name ="telegramTarget"
			layout="${message}"
            botToken ="xxx"
            chatId="xxx"
            format="MARKDOWN"
            />
  </targets>

  <rules>
    <logger name="*" minlevel="Debug" writeTo="telegramTarget" />
  </rules>
</nlog>

Configuration Options

Key Description
BotToken Your telegram bot token (e.g 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)
ChatId Unique identifier for the message recipient � User or GroupChat id
BaseUrl Optional. Api bot Url. Default: https://api.telegram.org/bot
Format Optional. Render layout for telegram message. Default : DEFAULT

Reference: https://github.com/narfunikita/NLog.Telegram

About

.NET Core NLog target for Telegram with the available format which provided by Telegram. Available format: MARKDOWN HTML5

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages