Package - Serilog.Sinks.Twilio | Platforms - .NET 4.5, .NET Standard 1.4
If you want to include the Twilio sink in your project, you can install it directly from NuGet.
To install the sink, run the following command in the Package Manager Console:
PM> Install-Package Serilog.Sinks.Twilio
In the following example, the sink will transmit log events to <toPhoneNumber>
over SMS.
var log = new LoggerConfiguration()
.WriteTo.Twilio(
accountSid: "<your_account_sid>",
authToken: "<your_auth_token>",
fromPhoneNumber: "<fromPhoneNumber>",
toPhoneNumber: "<toPhoneNumber>",
restrictedToMinimumLevel: LogEventLevel.Information)
.CreateLogger();
log.Information("Hello World!");
Used in conjunction with Serilog.Settings.Configuration the same sink can be configured in the following way:
{
"Serilog": {
"MinimumLevel": "Fatal",
"WriteTo": [
{
"Name": "Twilio",
"Args": {
"accountSid": "your_account_sid",
"authToken": "your_auth_token",
"fromPhoneNumber": "from_phone_number",
"toPhoneNumber": "to_phone_number"
}
}
]
}
}