Serilog.Sinks.MicrosoftTeams is a library to save logging information from Serilog to Microsoft Teams. The assembly was written and tested in NetCore 3.1, .Net Framework 4.8 and .Net Standard 2.0.
- NetFramework 4.6
- NetFramework 4.6.2
- NetFramework 4.7
- NetFramework 4.7.2
- NetFramework 4.8
- NetStandard 2.0
- NetStandard 2.1
- NetCore 2.1
- NetCore 3.1
- https://dotnet.microsoft.com/download/dotnet-framework
- https://dotnet.microsoft.com/download/dotnet-core
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.
Check https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/connectors/connectors-using.
var logger = new LoggerConfiguration()
.WriteTo.MicrosoftTeams(webHookUri, title: title)
.CreateLogger();
The project can be found on nuget.
Parameter | Meaning | Example | Default value |
---|---|---|---|
webHookUri | The Microsoft teams weebhook uri. | "User ID=serilog;Password=serilog;Host=localhost;Port=5432;Database=Logs" |
None, is mandatory. |
title | The title of the card. | "Some Message" |
None, but is optional. |
period | The time to wait between checking for event batches. | period: new TimeSpan(0, 0, 20) |
00:00:05 |
formatProvider | The IFormatProvider to use. Supplies culture-specific formatting information. Check https://docs.microsoft.com/en-us/dotnet/api/system.iformatprovider?view=netframework-4.8. |
new CultureInfo("de-DE") |
null |
batchSizeLimit | The maximum number of events to include in a single batch. | batchSizeLimit: 40 |
30 |
restrictedToMinimumLevel | The minimum level of the logging. | restrictedToMinimumLevel: LogEventLevel.Verbose |
LogEventLevel.Verbose |
omitPropertiesSection | Indicates whether the properties section should be omitted or not. | omitPropertiesSection: true |
false |
proxy | The proxy addresss used. | proxy: "http://test.de/proxy" |
null |
buttons | Add static clickable buttons to each message. | buttons: new[] { new MicrosoftTeamsSinkOptionsButton("Google", "https://google.se") } |
null |
This project is a fork of https://github.com/DixonDs/serilog-sinks-teams but is maintained. Do not hesitate to create issues or pull requests.
See the Changelog.