J4JSoftware.Logging.Twilio
4.2.0
See the version list below for details.
dotnet add package J4JSoftware.Logging.Twilio --version 4.2.0
NuGet\Install-Package J4JSoftware.Logging.Twilio -Version 4.2.0
<PackageReference Include="J4JSoftware.Logging.Twilio" Version="4.2.0" />
paket add J4JSoftware.Logging.Twilio --version 4.2.0
#r "nuget: J4JSoftware.Logging.Twilio, 4.2.0"
// Install J4JSoftware.Logging.Twilio as a Cake Addin #addin nuget:?package=J4JSoftware.Logging.Twilio&version=4.2.0 // Install J4JSoftware.Logging.Twilio as a Cake Tool #tool nuget:?package=J4JSoftware.Logging.Twilio&version=4.2.0
Twilio Sink for J4JLogger
This library provides a Serilog sink which J4JLogger can use to send SMS messages via Twilio.
See the github documentation for J4JLogger for more information.
Adding a TwilioSink
to J4JLoggerConfiguration
is straightforward. This example assumes the required configuration information is contained in a user-secrets cache since I don't want my Twilio credentials available publicly. It also does not contain any recipient phone numbers so it will not work as shown:
var configBuilder = new ConfigurationBuilder();
var config = configBuilder
.AddUserSecrets<LoggingTests>()
.Build();
var twilioConfig = new TwilioConfiguration
{
AccountSID = config.GetValue<string>( "twilio:AccountSID" ),
AccountToken = config.GetValue<string>( "twilio:AccountToken" ),
FromNumber = config.GetValue<string>( "twilio:FromNumber" ),
Recipients = new List<string> { /* recipient phone numbers go here */ }
};
var loggerConfig = new J4JLoggerConfiguration( FilePathTrimmer )
.AddTwilio( twilioConfig );
You can supply a Serilog
output template string to the sink but by default it uses one that contains both calling context information (e.g., calling method name) and the placeholder required to trigger the sending of SMS messages.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- J4JSoftware.Logging (>= 4.2.0)
- Twilio (>= 6.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
updated to net7