Gasconade 1.2.0
dotnet add package Gasconade --version 1.2.0
NuGet\Install-Package Gasconade -Version 1.2.0
<PackageReference Include="Gasconade" Version="1.2.0" />
paket add Gasconade --version 1.2.0
#r "nuget: Gasconade, 1.2.0"
// Install Gasconade as a Cake Addin #addin nuget:?package=Gasconade&version=1.2.0 // Install Gasconade as a Cake Tool #tool nuget:?package=Gasconade&version=1.2.0
Gasconade
<img src="https://github.com/i-e-b/gasconade/raw/master/icon.png"/> https://www.nuget.org/packages/Gasconade
A self-documenting logging system for .Net -- like Swagger (UI) for logs.
Concepts
Configuring:
public class MyListenerClass: ILogListener { . . . }
. . .
Log.AddListener(new MyListenerClass());
Calling:
Log.Warning(new FailedToSend{Client="WhizbangSvc", Reason="it was rejected by client"});
Message Setup:
// This is the structure of the message, with replacement blocks:
[LogMessageTemplate("Could not send message to {Client} because {Reason}")]
// This text explains why the message would be logged, and what to do about it -- to be used by an Operations team:
[LogMessageDescription("A message was to be sent to a 3rd party client, but a non-network error occured.",
Causes = "Sent as a warning if it is not customer-impacting, as an error otherwise.",
Actions = "Check configuration matches accounts if one client gets repeated errors.")]
public class FailedToSend : TemplatedLogMessage {
[LogParam("The 3rd party we were trying to send to")]
public string Client {get;set;}
[LogParam("Human-readable reason the message failed")]
public string Reason {get;set;}
}
Sample Result:
Could not send message to WhizbangSvc because it was rejected by client
Gasconade UI
Aspnet Core MVC
Add to application configuration like:
app.UseMvc();
app.UseGasconadeUI(config => {
config.AddAssembly(typeof(AnyMessageInTheProject).Assembly);
});
.Net Framework MVC WebApi
Add in global config like:
protected void Application_Start() {
. . .
GlobalConfiguration.Configure(MyGasconadeConfig.Register);
}
And a class like:
public class GasconadeConfig {
public static void Register(HttpConfiguration config) {
config.EnableGasconadeUi();
}
}
Accessing the UI
If the setup is correct, there should be a route at http(s)://. . ./gasconade
that exposes the UI.
You can add a link from your SwaggerUI like this:
config.EnableSwagger(c => {
c.SingleApiVersion("v1", "SampleWebApi")
.Description("A sample web application.<br/>For logging details, see " + GasconadeUi.Link("here"));
})
.EnableSwaggerUi(c => {
c.DocumentTitle("My Swagger UI");
});
If your message definitions are in a different assembly, you can add them like this:
config.EnableGasconadeUi(c =>
{
c.AddAssembly(typeof(AnyMessageInTheProject).Assembly);
});
You can add a link back to Swagger UI like this:
config.EnableGasconadeUi(c =>
{
. . .
c.AddSwaggerLink();
});
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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net46 is compatible. 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. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
- Tag (>= 1.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Ability to clear listeners