ConsoleDebugger.FloatTracker
1.0.8
dotnet add package ConsoleDebugger.FloatTracker --version 1.0.8
NuGet\Install-Package ConsoleDebugger.FloatTracker -Version 1.0.8
<PackageReference Include="ConsoleDebugger.FloatTracker" Version="1.0.8" />
<PackageVersion Include="ConsoleDebugger.FloatTracker" Version="1.0.8" />
<PackageReference Include="ConsoleDebugger.FloatTracker" />
paket add ConsoleDebugger.FloatTracker --version 1.0.8
#r "nuget: ConsoleDebugger.FloatTracker, 1.0.8"
#addin nuget:?package=ConsoleDebugger.FloatTracker&version=1.0.8
#tool nuget:?package=ConsoleDebugger.FloatTracker&version=1.0.8
ConsoleDebugger.FloatTracker
Extension of ConsoleDebugger. Introduces auditory float tracking. Pass any float variable in your application, and a min/max range to hear an auditory tone representing the value in range as a percentage. Can be useful for developing where I/O is dealing with large quantities of information or preforming several rapid operations - good for mental visualization.
Overview
ConsoleDebugger is a lightweight utility for console applications, providing robust logging and debug message management. It is ideal for applications with multiple asynchronous methods, background processes, or network operations. As of v1.0.8, advanced features such as audible beeps and float tracking are now available as separate extension packages, reducing the core package size and dependencies for users who only need basic logging.
Installation
To use ConsoleDebugger in your C# console application:
- Install the core ConsoleDebugger package via NuGet:
dotnet add package ConsoleDebugger --version 1.0.8
- Add the following using directive in your C# files:
using ConsoleDebugger.ConsoleDebugger;
Or, for a more functional approach:
using static ConsoleDebugger.ConsoleDebugger;
Optional Extensions
Audible Beeps:
InstallConsoleDebugger.Beeps
for beep/tone support:dotnet add package ConsoleDebugger.Beeps --version 1.0.8
using ConsoleDebugger.Beeps;
Float Tracking:
InstallConsoleDebugger.FloatTracker
for auditory float tracking:dotnet add package ConsoleDebugger.FloatTracker --version 1.0.8
using ConsoleDebugger.FloatTracker;
Usage
Logging Debug Messages
Log debug messages with different colors and message types:
Result result = SomeNetworkFunction(); // example function
ConsoleDebugger.DebugMessage("We started the network function.");
if(result == Good){
ConsoleDebugger.DebugMessage($"Here's the result {result.ToString()}", ConsoleColor.Blue);
} else {
ConsoleDebugger.DebugMessage($"Critical error occurred: {result.Message}", MessageType.Critical);
}
Logging Categories
You can define and control logging categories:
var netCategory = new LoggingCategory("Network");
ConsoleDebugger.AddLoggingCategory(netCategory);
ConsoleDebugger.DebugMessage("Network started", netCategory);
You can also control which logging categories are shown in the console output. By default, all categories are considered enabled. Use ActivateLoggingCategory(category)
to enable console output for a category, or DeactivateLoggingCategory(category)
to suppress it so the category no longer outputs to the console.
Note: Logging categories are always included in the file log if file logging is enabled, regardless of their console output status.
Optional File Logging
You can log messages to a file in either .txt
or .csv
format. By default, logs include the message, but you can configure additional options such as including timestamps, logging categories, and message types. The output format and included fields are controlled via the LoggingConfiguration
class.
- .txt format: Plain text log entries, optionally with timestamp, category, and message type.
- .csv format: Comma-separated values, suitable for importing into spreadsheets or analysis tools. Each field (timestamp, category, type, message) appears as a column if enabled.
Enable or disable file logging:
ConsoleDebugger.StartLogging();
// ... your code ...
ConsoleDebugger.StopLogging();
Configure logging style and options via the LoggingConfiguration
class, for example:
var config = new LoggingConfiguration {
IncludeTimestamp = true,
IncludeCategory = true,
IncludeMessageType = true,
LogFormat = LogFormat.Csv // or LogFormat.Txt
};
ConsoleDebugger.SetLoggingConfiguration(config);
Audible Beeps (Extension)
To use beeps, ensure you have installed the ConsoleDebugger.Beeps
package and initialized beeps:
ConsoleDebugger.InitializeBeeps();
ConsoleDebugger.DebugBeep(TonePitch.Do, ToneLength.Short);
ConsoleDebugger.DebugBeep(TonePitch.Re, ToneLength.Short);
Tracking Float Variables (Extension)
To use float tracking, ensure you have installed the ConsoleDebugger.FloatTracker
package and initialized float tracking:
ConsoleDebugger.InitializeFloatTracking();
float valueToTrack = 0.0f;
var synthesizer = ConsoleDebugger.StartTrackingFloat(ref valueToTrack, 0.0f, 100.0f);
As valueToTrack
changes, an auditory tone will represent its value within the specified range.
Function Details
Core
DebugMessage(string message, LoggingCategory category = default)
DebugMessage(string message, ConsoleColor color, LoggingCategory category = default)
DebugMessage(string message, MessageType type, LoggingCategory category = default)
StartLogging()
,StopLogging()
- Logging category management:
AddLoggingCategory
,RemoveLoggingCategory
,ActivateLoggingCategory
,DeactivateLoggingCategory
,LoggingCategoryActive
Beeps Extension
DebugBeep(TonePitch pitch, ToneLength duration)
InitializeBeeps()
Float Tracker Extension
StartTrackingFloat(ref float target, float minrange, float maxrange) : FloatSynthesizer
InitializeFloatTracking()
License
This project is licensed under the MIT License. See the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- ConsoleDebugger (>= 1.0.8)
- NAudio (>= 2.2.1)
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.8 | 216 | 5/13/2025 |