Skip to content

A Serilog event sink that writes to Microsoft Teams

License

Notifications You must be signed in to change notification settings

serilog-contrib/serilog-sinks-teams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serilog.Sinks.MicrosoftTeams


NuGet Version

A Serilog event sink that writes to Microsoft Teams.

Package - Serilog.Sinks.MicrosoftTeams | Platforms - .NETStandard 1.1

You need to add an "Incoming Webhook" connector to your Teams channel and get it's URL. title is optional but can help your distinguish logs coming from different sources.

var log = new LoggerConfiguration()
    .WriteTo.MicrosoftTeams(webHookUri, title: title)
    .CreateLogger();

JSON configuration

It is possible to configure the sink using Serilog.Settings.Configuration by specifying the table name and connection string in appsettings.json:

"Serilog": {
  "WriteTo": [
    {"Name": "MicrosoftTeams", "Args": {"webHookUri": "", "title": ""}}
  ]
}

JSON configuration must be enabled using ReadFrom.Configuration(); see the documentation of the JSON configuration package for details.