OwlCore.Diagnostics
0.0.0
dotnet add package OwlCore.Diagnostics --version 0.0.0
NuGet\Install-Package OwlCore.Diagnostics -Version 0.0.0
<PackageReference Include="OwlCore.Diagnostics" Version="0.0.0" />
<PackageVersion Include="OwlCore.Diagnostics" Version="0.0.0" />
<PackageReference Include="OwlCore.Diagnostics" />
paket add OwlCore.Diagnostics --version 0.0.0
#r "nuget: OwlCore.Diagnostics, 0.0.0"
#:package OwlCore.Diagnostics@0.0.0
#addin nuget:?package=OwlCore.Diagnostics&version=0.0.0
#tool nuget:?package=OwlCore.Diagnostics&version=0.0.0
OwlCore.Diagnostics 
Supplemental diagnostic tooling for dotnet.
Featuring:
- A simple static Logger for consolidating outputting one or more log streams.
- ProcessHelpers for interacting with executable binaries.
Install
Published releases are available on NuGet. To install, run the following command in the Package Manager Console.
PM> Install-Package OwlCore.Diagnostics
Or using dotnet
> dotnet add package OwlCore.Diagnostics
Usage
Logger
var startTime = DateTime.Now;
// Logging output routing //
////////////////////////////
Logger.MessageReceived += Logger_MessageReceived;
void Logger_MessageReceived(object? sender, LoggerMessageEventArgs e) => Console.WriteLine(FormatLoggerMessage(e));
void Logger_MessageReceived(object? sender, LoggerMessageEventArgs e) => Debug.WriteLine(FormatLoggerMessage(e));
string FormatLoggerMessage(LoggerMessageEventArgs e) => $"+{Math.Round((DateTime.Now - startTime).TotalMilliseconds)}ms {Path.GetFileNameWithoutExtension(e.CallerFilePath)} {e.CallerMemberName} [{e.Level}] {e.Exception} {e.Message}";
// Additional logging input routing //
//////////////////////////////////////
// Normal unhandled application exceptions
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => Logger.LogError(e.ExceptionObject?.ToString() ?? "Error message not found", e.ExceptionObject as Exception);
// First chance exception log all exceptions, even if caught.
AppDomain.CurrentDomain.FirstChanceException += (object? sender, FirstChanceExceptionEventArgs e) => Logger.LogError(e.Exception?.ToString() ?? "Error message not found", e.Exception);
// Unobserved tasks (_ = SomethingAsync()) can suppress exceptions, but can be observed and routed nonetheless.
TaskScheduler.UnobservedTaskException += (object? sender, UnobservedTaskExceptionEventArgs e) => Logger.LogError(e.Exception?.ToString() ?? "Error message not found", e.Exception);
// Logging invocation //
////////////////////////
// Logs the general flow of the application. Can be used for interactive investigation during development.
Logger.LogInformation(information);
// Logs when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure.
Logger.LogError(message, exception);
// Logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop.
Logger.LogWarning(message);
// Logs an extremely detailed message. May contain sensitive application data. These messages should never be enabled in a production environment.
Logger.LogTrace(message);
// Logs an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention.
Logger.LogCritical(message);
ProcessHelpers
// Collect both output and error
var (output, error) = await ProcessHelpers.RunExecutable(new SystemFile("/path/to/binary"), arguments: $"-id \"{id}\" -port {portNumber}");
// Throwing instead of returning error
var (output, _) = await ProcessHelpers.RunExecutable(new SystemFile("/path/to/binary"), arguments: $"-id \"{id}\" -port {portNumber}", throwOnError: true);
Financing
We accept donations here and here, and we do not have any active bug bounties.
Versioning
Version numbering follows the Semantic versioning approach. However, if the major version is 0, the code is considered alpha and breaking changes may occur as a minor update.
License
All OwlCore code is licensed under the MIT License. OwlCore is licensed under the MIT License. See the LICENSE file for more details.
| Product | Versions 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. |
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- System.Linq.Async (>= 6.0.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on OwlCore.Diagnostics:
| Package | Downloads |
|---|---|
|
OwlCore
Have you ever seen an owl do a barrel roll? Me neither. Essential supplemental tooling for .NET development. |
|
|
OwlCore.Kubo
An essential toolkit for Kubo, IPFS and the distributed web. |
|
|
OwlCore.Nomad.Kubo
Build a modifiable application domain across Kubo peers with eventual consistency. Cover the gap between "User device" and "User". |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.0 | 4,243 | 7/23/2024 |
--- 0.0.0 ---
[New]
Initial release of OwlCore.Diagnostics.