J4JSoftware.Logging.Twilio 4.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package J4JSoftware.Logging.Twilio --version 4.0.1                
NuGet\Install-Package J4JSoftware.Logging.Twilio -Version 4.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="J4JSoftware.Logging.Twilio" Version="4.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add J4JSoftware.Logging.Twilio --version 4.0.1                
#r "nuget: J4JSoftware.Logging.Twilio, 4.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install J4JSoftware.Logging.Twilio as a Cake Addin
#addin nuget:?package=J4JSoftware.Logging.Twilio&version=4.0.1

// Install J4JSoftware.Logging.Twilio as a Cake Tool
#tool nuget:?package=J4JSoftware.Logging.Twilio&version=4.0.1                

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 Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.2.1 240 4/4/2023 4.2.1 is deprecated.
4.2.0 318 12/27/2022
4.1.0 475 2/28/2022
4.0.1 404 9/29/2021
4.0.0 338 9/28/2021
3.2.0 364 2/3/2021

Added nuget readme