J4JSoftware.Logging.Twilio 4.2.1

Suggested Alternatives

J4JSoftware.J4JLoggerTwilio

Additional Details

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                
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.2.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.2.1                
#r "nuget: J4JSoftware.Logging.Twilio, 4.2.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.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 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. 
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

updated packages, announced end of development