Serilog.Sinks.Signal 1.0.0

dotnet add package Serilog.Sinks.Signal --version 1.0.0
NuGet\Install-Package Serilog.Sinks.Signal -Version 1.0.0
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="Serilog.Sinks.Signal" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Serilog.Sinks.Signal --version 1.0.0
#r "nuget: Serilog.Sinks.Signal, 1.0.0"
#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 Serilog.Sinks.Signal as a Cake Addin
#addin nuget:?package=Serilog.Sinks.Signal&version=1.0.0

// Install Serilog.Sinks.Signal as a Cake Tool
#tool nuget:?package=Serilog.Sinks.Signal&version=1.0.0

Serilog.Sinks.Signal

A Serilog sink sending log events via Signal. It is developed based on the Serilog.Sinks.Http package. In order to be able to send Signal messages, you need first to configure your machine. You can use a Dockerized Signal Messenger REST API for this purpose.


Package: Serilog.Sinks.Signal

Platforms:

  • .NET 4.6.1
  • .NET Standard 2.0
  • .NET Standard 2.1

Introduction

This project started out with a wish to send log events via the Signal chat app.

Since the log events are sent through HTTP requests, I relied on the Serilog.Skins.Http to develop this package.

Getting started

In the following example, the sink will POST log events to a user or multiple users that you specify in the options, this will be done by adding the numbers to which log events are to be sent. You will also need to add the sender number and the API link for sending messages to Signal chats.

Log.Logger = new LoggerConfiguration()
        .MinimumLevel.Debug()
        .WriteTo.Signal(
            options: new Options
            {
                SignalSettings = new SignalSettings
                {
                    RrequestUri = "http://localhost:9000/v2/send",
                    SenderNumber = "+41000000000",
                    Recipients = new[] { "+41111111111", "+41222222222" }
                },
                TimeStampInUtc = false,
                TimeFormat = "dd.MM.yyyy hh:mm:ss"
            },
            null,
            restrictedToMinimumLevel: LogEventLevel.Information)
    .CreateLogger();

Log.Information("Hello Serilog Signal");

Used in conjunction with Serilog.Settings.Configuration the same sink can be configured in the following way:

{
  "Serilog": {
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "Signal",
        "Args": {
          "options": {
            "SignalSettings": {
              "RrequestUri": "http://localhost:9000/v2/send",
              "SenderNumber": "+41000000000",
              "Recipients": [ "+41111111111", "+41222222222" ]
            },
            "TimeStampInUtc": true,
            "TimeFormat": "dd.MM.yyyy hh:mm:ss"
          },
          "queueLimitBytes": null
        }
      }
    ]
  }
}

Like Serilog.Sinks.Http, the sink is batching multiple log events into a single request, just set logEventsInBatchLimit to the size you want. The following hypothetical payload is sent over the network.

The log appears as follows in the Signal chat app:

Timestamp: 15.01.2023 01:22:36  
  
Level:🔴Fatal  
  
MessageTemplate:  
"Object reference not set to an instance of an object."  
  
RenderedMessage:  
"Object reference not set to an instance of an object."

Exception:  
"System.NullReferenceException: Object reference not set to an instance of an object.\r\n at Program.<Main>$(String[] args) in C:\\TestProjects\\source\\code\\Test.Store.Api\\Program.cs:line 27"

Properties:  
MachineName: "Husam"  
ProcessId: 5512  
ThreadId: 1  
ExceptionDetail: [("Type": "System.NullReferenceException"), ("HResult": -2147467261), ("Message": "Object reference not set to an instance of an object."), ("Source": "Test.Store.Api"), ("StackTrace": " at Program.<Main>$(String[] args) in C:\TestProjects\source\code\Test.Store.Api\Program.cs:line 27"), ("TargetSite": "Void <Main>$(System.String[])")]

Install via NuGet

If you want to include the HTTP 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.Signal
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.0 277 1/15/2023