J4JSoftware.Logging.Twilio
4.2.1
I've significantly redesigned how my logging enhancement system works and extended it to include the Microsoft logging system in addition to Serilog
dotnet add package J4JSoftware.Logging.Twilio --version 4.2.1
NuGet\Install-Package J4JSoftware.Logging.Twilio -Version 4.2.1
<PackageReference Include="J4JSoftware.Logging.Twilio" Version="4.2.1" />
paket add J4JSoftware.Logging.Twilio --version 4.2.1
#r "nuget: J4JSoftware.Logging.Twilio, 4.2.1"
// Install J4JSoftware.Logging.Twilio as a Cake Addin #addin nuget:?package=J4JSoftware.Logging.Twilio&version=4.2.1 // Install J4JSoftware.Logging.Twilio as a Cake Tool #tool nuget:?package=J4JSoftware.Logging.Twilio&version=4.2.1
Twilio Sink for J4JLogger
As of 2023 April 4 I am no longer developing this library.
The reason is simple: I learned more about how Serilog works and realized there was a much easier way of implementing the same functionality 😃.
Take a look at J4JLoggerEnhancements for a new, slimmer approach for doing what J4JLogging does.
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.
Licensed under GNU GPL-v3.0. See the license file for details.
See the change log for a history of changes to the library.
Adding a TwilioSink
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.1)
- 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 packages, announced end of development