Mamemaki.EventFlow.HealthReporters.StdOutput 1.0.1

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

// Install Mamemaki.EventFlow.HealthReporters.StdOutput as a Cake Tool
#tool nuget:?package=Mamemaki.EventFlow.HealthReporters.StdOutput&version=1.0.1                

Mamemaki.EventFlow.HealthReporters.StdOutput

Introduction

This is a custom health reporter for Microsoft.Diagnostics.EventFlow to write to the console window.

The general flow of the process:

  1. If the report level is less than minReportLevel value, skip the process.
  2. Construct message string by corresponding to messageFormat value.
  3. Output message string to STDOUT. If outputToStdError is true, output to STDERR instead of STDOUT.

Getting Started

To quickly get started, you can create a simple console application in VisualStudio as described below or just download and run PlayGround project.

1. Install NuGet packages

PM> Install-Package Microsoft.Diagnostics.EventFlow.Inputs.Trace
PM> Install-Package Microsoft.Diagnostics.EventFlow.Outputs.StdOutput
PM> Install-Package Mamemaki.EventFlow.HealthReporters.StdOutput

2. Add "eventFlowConfig.json"

Add a JSON file named "eventFlowConfig.json" to your project and set the Build Action property of the file to "Copy if Newer". Set the content of the file to the following:

{
  "inputs": [
    {
      "type": "Trace",
      "traceLevel": "Warning"
    }
  ],
  "outputs": [
    {
      "type": "StdOutput"
    }
  ],
  "healthReporter": {
    "type": "StdOutputHealthReporter",
    "minReportLevel": "Healthy",
    "outputToStdError": "false",
    "messageFormat": "[HR] ${TimeStamp} ${Context} [${Level}]: ${Message}"
  },
  "schemaVersion": "2016-08-11",
  "extensions": [
    {
      "category": "healthReporter",
      "type": "StdOutputHealthReporter",
      "qualifiedTypeName": "Mamemaki.EventFlow.HealthReporters.StdOutput.StdOutputHealthReporter, Mamemaki.EventFlow.HealthReporters.StdOutput"
    }
  ]
}

3. Create an EventFlow pipeline

Create an EventFlow pipeline in your application code using the code below. Run your application and see your traces in console output.

    using (var pipeline = DiagnosticPipelineFactory.CreatePipeline("eventFlowConfig.json"))
    {
        System.Diagnostics.Trace.TraceWarning("EventFlow is working!");
        Console.WriteLine("Press any key to exit...");
        Console.ReadKey(intercept: true);
    }

console window

Configuration Details

Health reporter parameters

Parameter Description Required(default)
type Type of health reporter. It must be set StdOutputHealthReporter. Yes(StdOutputHealthReporter)
minReportLevel Specifies the collection report level. Report traces with equal or higher severity than specified are collected. For example, if Warning is specified, then Problem, and Warning traces are collected. Default is Problem. Allowed values are Healthy, Warning, or Problem. No(Problem)
suppressEmptyMessage If set true, skip report if message is empty. No(false)
outputToStdError If set true, write to stderr. If false, write to stdout. No(false)
messageFormat Format of the output message. For more details, see Message format No(${TimeStamp} ${Context} [${Level}] ${Message})

Message format

You can set the message format for customizing output string. The format token will be replaced by the corresponding value.

The following format tokens are available:

Name Description
${Timestamp} Timestamp of the event
${Context} Context(Usually class name) of the event
${Level} Report level name of the event
${Message} Message text of the event
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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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 was computed. 
.NET Framework net461 was computed.  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.1 79 2/8/2025
1.0.0 3,053 9/6/2018