Serilog.Crestron 2.1.0

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

// Install Serilog.Crestron as a Cake Tool
#tool nuget:?package=Serilog.Crestron&version=2.1.0                

Serilog Crestron

About

A collection of sinks, enrichers, and extensions used to create structured logging on Crestron Automation Platform for Audio And Video integration. Used on Crestron 4-Series Control Appliances and Control Servers.

Get Started

To use the different sinks, enrichers and extensions, first install the NuGet package:

dotnet add package Serilog.Crestron

Crestron Console Sink

To enable sinks that write to a Crestron Console use:

Log.Logger = new LoggerConfiguration()
    .WriteTo.CrestronConsole()
    .CreateLogger();

Log.Information("Hello world");

When connected via ssh or using toolbox text console tool, you'll see the output:

[12:50:51 INF] Hello, world!

Crestron Error Log Sink

To enable sinks that write to a the Crestron Error Log use:

Log.Logger = new LoggerConfiguration()
    .WriteTo.CrestronErrorLog()
    .CreateLogger();

Log.Information("Hello world");

When connected using toolbox text console tool enter ERRLOG PLOGALL and you will see

6. Notice: SimplSharpPro[App01] # 2023-04-01 11:24:36 # [INF] Hello, world!

or when using VC4 connect via ssh, enter JOURNALCTL -xef -u VirtualControl and you will see an entry like this on:

Apr 03 22:05:33 VC4 SimplSharpPro[50389]: [INF] Hello, world!

Enrichers

The enrichers supported are:

  • SlotNo: Provides the number of the slot the program is running on for Processors, or the Room Instance Id for Virtual Control
  • ProgramName: Provides the Name of the Running Program. The assembly name in Processors , or the Program name in Virtual Control

Add Enrich.WithSlotNo() and/or Enrich.WithProgramName() to the LoggerConfiguration()

_crestronErrorLog = new LoggerConfiguration()
    .Enrich.WithSlotNo()
    .Enrich.WithProgramName()
    .WriteTo.CrestronErrorLog(
        outputTemplate: "[{Level:u3} {SlotNo}-{ProgramName}] {Message:lj}")
    .CreateLogger();  

Extensions

An extension to ILogger that adds the following properties to the running log:

  • FileName: Name of the File where the log originated
  • MemberName: Name of the containing Method where the log originated
  • LineNumber: Line Number where the log originated

Add this extension add it to the Global Logger or instance logger

 Log.Logger.FromHere().Verbose("{FileName}-{MemberName}-{LineNumber} Something to log");
 _myLog.FromHere().Verbose("{FileName}-{MemberName}-{LineNumber} Something to log");

Copyright © All Contributers - Provided under the Apache License, Version 2.0.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 Framework net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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
2.1.0 557 12/16/2023
2.0.0 329 8/11/2023
1.0.0 258 4/19/2023

# v2.1.0
           * Updated to support net6.0