PanoramicData.ConsoleExtensions 1.0.16

dotnet add package PanoramicData.ConsoleExtensions --version 1.0.16
                    
NuGet\Install-Package PanoramicData.ConsoleExtensions -Version 1.0.16
                    
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="PanoramicData.ConsoleExtensions" Version="1.0.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PanoramicData.ConsoleExtensions" Version="1.0.16" />
                    
Directory.Packages.props
<PackageReference Include="PanoramicData.ConsoleExtensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PanoramicData.ConsoleExtensions --version 1.0.16
                    
#r "nuget: PanoramicData.ConsoleExtensions, 1.0.16"
                    
#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.
#:package PanoramicData.ConsoleExtensions@1.0.16
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PanoramicData.ConsoleExtensions&version=1.0.16
                    
Install as a Cake Addin
#tool nuget:?package=PanoramicData.ConsoleExtensions&version=1.0.16
                    
Install as a Cake Tool

PanoramicData.ConsoleExtensions

Extensions for the System.Console namespace

install-package PanoramicData.ConsoleExtensions

ConsolePlus.ReadPassword

This method provides a simple and safe way to read a password from the command line, including permitting the user to use the backspace key.

using PanoramicData.ConsoleExtensions;

...

Console.Write("Password: ");
var password = ConsolePlus.ReadPassword();
Console.WriteLine();

ConsoleLogger

This class provides a simple ILogger implementation for the command line. It implements colored logging, with control over the color used for each log level and sensible defaults.

Basic Usage

using PanoramicData.ConsoleExtensions;

...

var consoleLogger1 = new ConsoleLogger();
consoleLogger1.LogInformation("The Date is {DateTime:yyyy-MM-dd}", DateTime.UtcNow);

var consoleLogger2 = new ConsoleLogger(new ConsoleLoggerOptions
	{
		TraceColor = ConsoleColor.DarkYellow,
		LogLevel = LogLevel.Debug
	});
consoleLogger2.LogTrace("The Date is {DateTime:yyyy-MM-dd}", DateTime.UtcNow);
consoleLogger2.LogError(exception, "Failure occurred at {DateTime:yyyy-MM-dd}", DateTime.UtcNow);

Structured Logging Features

The ConsoleLogger supports advanced structured logging features while maintaining backward compatibility:

Timestamps and Custom Formatting
var options = new ConsoleLoggerOptions
{
    IncludeTimestamp = true,
    IncludeEventId = true,
    TimeFormat = "yyyy-MM-dd HH:mm:ss.fff",
    OutputFormat = "{Timestamp} [{Level}] ({EventId}) {Message}"
};
var logger = new ConsoleLogger(options);
logger.LogInformation(new EventId(1001), "User {UserName} logged in", "Alice");

URLs and file paths are automatically detected and made clickable in supported terminals:

var options = new ConsoleLoggerOptions { EnableHyperlinks = true };
var logger = new ConsoleLogger(options);
logger.LogInformation("Visit https://github.com/panoramicdata/PanoramicData.ConsoleExtensions");
logger.LogInformation("Error in file: C:\\Source\\MyProject\\Program.cs");
Exception Formatting

Choose between detailed multi-line or compact single-line exception formatting:

var options = new ConsoleLoggerOptions { SingleLineExceptions = true };
var logger = new ConsoleLogger(options);
logger.LogError(exception, "Operation failed");

Demo Application

A comprehensive demo application is included in the PanoramicData.ConsoleExtensions.Demo project that showcases all the library features:

  • Interactive password reading demonstration
  • Default console logger with standard colors and log levels
  • Custom console logger with custom colors and log level filtering
  • Structured logging examples
  • Exception logging examples

To run the demo:

cd PanoramicData.ConsoleExtensions.Demo
dotnet run

Or use the VS Code launch configuration "Run Demo" for easy debugging.

Publishing to NuGet

A PowerShell script publish.ps1 is provided for easy publishing to NuGet.org:

Setup

  1. Obtain a NuGet API key from https://www.nuget.org/account/apikeys
  2. Replace the contents of nuget.key with your actual API key (the file should contain only the key)
  3. Run the publish script

Usage

# Publish with default settings (Release configuration)
.\publish.ps1

# Specify custom configuration
.\publish.ps1 -Configuration Debug

# Use a different key file
.\publish.ps1 -KeyFile "my-api-key.txt"

# Auto-publish without confirmation prompt
.\publish.ps1 -SkipConfirmation

Windows Users: You can also use publish.bat which bypasses PowerShell execution policy restrictions.

The script will:

  • Validate the API key file exists and contains a valid key
  • Build the solution in the specified configuration
  • Create the NuGet package
  • Prompt for confirmation before publishing
  • Publish to NuGet.org

Security Note: The nuget.key file is automatically excluded from Git via .gitignore to protect your API key.

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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.16 132 7/14/2025
1.0.15 128 7/14/2025
1.0.12 33,876 7/1/2022
1.0.11 488 7/1/2022
1.0.5 1,111 2/20/2022
1.0.4 540 2/13/2022
1.0.1 19,089 1/9/2020

Added structured logging support with timestamps, event IDs, custom formatting, and hyperlink detection. Maintained full backward compatibility.