Shift4_ExternalISV_CloudLogging 1.0.0.2

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

// Install Shift4_ExternalISV_CloudLogging as a Cake Tool
#tool nuget:?package=Shift4_ExternalISV_CloudLogging&version=1.0.0.2

Shift4 will provide aws credentials Shift4 will provide the region Shift4 will provide the loggroup

The locationIdentifier should be something unique to the site, and the instance of the application.
The location identifier must use regexpression conforming string Colons are not allowed. Asterisks are not allowed. Please keep locationIdentifiers under 100 characters, as the Cloudwatch logstream generated from this is limited to 512 characters.

For pc's that have one instance running a mac address could suffice For pc's that have more then one instance a mac address plus an instance identifier will help keep logs seperate in the cloud. Additional details can be added to locationIdentifier, but it is best to keep this somewhat short.
Additionally, logging some unique details to the site on start up will help associate the locationIdentifier with an actual site. Suggestions might be to log the check headers on start up to get the phone number/location name.... This will help to identify who a locationIdentifier might belong to in the cloud.

Example Implementation.

using Shift4_ExternalISV_CloudLogging;
using System.Collections.Generic;

namespace TestExternalLogger
{
    class Program
    {
        public static void Main(string[] args)
        {
            LogSettings logSettings = new LogSettings();
            logSettings.cloudLoggingOn = true;
            logSettings.cloudWatchAccess = "access";
            logSettings.cloudWatchSecret = "secret";
            logSettings.locationIdentifier = "AA-BB-CC-DD-EE-FF-MeffertsLab"; //Something unique to the service logging like a MAC address
            logSettings.logGroup = LoggingUtils.LogGroup.microsBridge.Value;
            logSettings.region = LoggingUtils.LogRegion.useast1.Value;

            //Standard way to log
            LoggingUtils.writeLog(logSettings, "stand test", LoggingUtils.LogAppender.Program);


            //Log a list of log lines
            List<string> aListOfStringsToLog = new List<string>();
            aListOfStringsToLog.Add("TestLine1");
            aListOfStringsToLog.Add("TestLine2");
            LoggingUtils.writeLogArrayStringList(logSettings, aListOfStringsToLog, LoggingUtils.LogAppender.Program);

            //Log an object that can be serialized.  //will not log object if errored out for reasons like circular references.

            LoggingUtils.writeLogJsonObject(logSettings, logSettings, LoggingUtils.LogAppender.Program);
        }
    }
}

Example Output

2021-07-13 15:22:52,931 [1] DEBUG Shift4_ExternalISV_CloudLogging.LoggingUtils - Program:stand test 
2021-07-13 15:22:55,103 [1] DEBUG Shift4_ExternalISV_CloudLogging.LoggingUtils - Program:TestLine1
TestLine2
 
2021-07-13 15:22:56,445 [1] DEBUG Shift4_ExternalISV_CloudLogging.LoggingUtils - Program:{"cloudLoggingOn":true,"logGroup":"/bridge/isv/micros","region":"us-east-1","cloudWatchAccess":"access","cloudWatchSecret":"secret","locationIdentifier":"AA-BB-CC-DD-EE-FF-MeffertsLab"} 

V1.0.0.2 Added Support for formatting the logSettings.locationIdentifier to conform to AWS Cloudwatch standards. ":" will be replaced with"-" "*" will be replaced with "-" Long identifiers will be truncated at 100 characters.

Product Compatible and additional computed target framework versions.
.NET Framework net451 is compatible.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  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
1.0.0.2 399 7/28/2021
1.0.0.1 309 7/13/2021

Initial Package