qdx 2.0.1
dotnet add package qdx --version 2.0.1
NuGet\Install-Package qdx -Version 2.0.1
<PackageReference Include="qdx" Version="2.0.1" />
<PackageVersion Include="qdx" Version="2.0.1" />
<PackageReference Include="qdx" />
paket add qdx --version 2.0.1
#r "nuget: qdx, 2.0.1"
#:package qdx@2.0.1
#addin nuget:?package=qdx&version=2.0.1
#tool nuget:?package=qdx&version=2.0.1
Quotidian Diagnostics
Everyday diagnostics for every day
qdx is a modular, package style dependency that provides a simple, injectable interface for logging in a language agnostic way.
Another dx library?
Diagnostics seems like it should be a solved™ problem. After all, it's one of the most basic and ubiquitous tasks in programming. Yet, there remains an active level of debate and "churn" as new logging frameworks are born and die every day.
qdx is based on the idea that an application developer wants a simple interface to signal trouble, confusion or resolution with a reusable package, with an injectable interface, and without taking on a large dependency. In this way, the package was influenced by this answer on stack overflow. Steven's advice was enlightening the first time I read it. In my own words:
logging has two facets:
- signaling, done by the domain code, is about pushing information.
- recording, done by the logging framework, is about persisting information.
A domain module's point of view of logging is just about signaling and this requires such a simple interface it's almost never worth taking a dependency
If you subscribe to the ideas of dependency injection, the entry point takes on the responsibility of adapting a specific logging framework to the various module's logging interface; a small job that frees the other modules from a direct dependency on any specific logging framework.
What I think was missing from this discussion though, is consistency and its effect on readability. I felt there was still some value in sharing just this "simple interface".
qdx is just about signaling. It doesn't do formatting. It doesn't actually write anything. that work is left to you, likely as an adapter to an existing framework. You can feel confident about taking this dependency on because it's trivial to reimplement if you ever decide you need to drop it.
External dependencies
None
Installation
qdx is provided as a nuget package. Use the nuget package manager in Visual Studio to install package qdx or from the package manage console install-package qdx
Examples
The basic interfaces in qdx are ITrace and ILogEntry. A module that needs to signal diagnostics should have an ITrace injected, and send an ILogEntry. ILogEntry has a TraceLevel property which is yet another enum containing the typical logging levels: Critical, Error, Warning, Information, Verbose, Off. The list is well understood as part of a logging strategy and reimplemented in qdx to avoid taking a dependency on any other diagnostics framework.
LogEntry is a simple implementation of ILogEntry to facilitate sending messages.
There are also a few extension classes which add syntactic sugar for signaling an ILogEntry. These extension classes are segregated for their application to levels of modules: application level and domain level. In this context, an application level module is any module responsible for presentation to the user. Domain level is everything else. Distinguishing which level module code is in informs when to use logging and when to use errors (e.g., Exceptions).
For application level code, qdx provides Error and Critical level signaliing.
using Quotidian.Diagnostics.Source
public void DoActivity(ITrace trace)
{
trace.Warning("Activity cannot be done" )
}
API
Contribute
I consider qdx "feature complete". Remember, it's supposed to be dead simple. However, if you find a defect, have some additional insight, or an idea for a change in the API, any of the usual channels is fine: send a private message, log an issue, or send a pull request.
License
MIT
| 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 | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard1.0 is compatible. netstandard1.1 was computed. netstandard1.2 was computed. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net45 was computed. net451 was computed. 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. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
| Universal Windows Platform | uap was computed. uap10.0 was computed. |
| Windows Phone | wp8 was computed. wp81 was computed. wpa81 was computed. |
| Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 1.0
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fixup the formatting from ExceptionExtenstion ToTrace
Correct namespaces in Test project