skills/logging/SKILL.md
Configure structured logging with Serilog for .NET applications. Covers sink configuration, enrichment, correlation IDs, log levels, sensitive data filtering, and diagnostic context. Use when: setting up Serilog, configuring log sinks, adding structured context to log entries, filtering sensitive data, or troubleshooting logging issues.
npx skillsauth add congiuluc/my-awesome-copilot loggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
builder.Host.UseSerilog((context, services, config) => config
.ReadFrom.Configuration(context.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.Enrich.WithMachineName()
.Enrich.WithProperty("Application", "MyApp.Api")
.WriteTo.Console(outputTemplate:
"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}")
.WriteTo.File("logs/app-.log",
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 30));
| Level | Use When | Examples |
|-------|----------|---------|
| Verbose | Internal framework detail | EF Core query SQL |
| Debug | Developer diagnostics | Cache hit/miss, config loaded |
| Information | Normal operations | Request started, user logged in |
| Warning | Expected but notable | Not found, validation failed, slow query |
| Error | Unexpected failures | Unhandled exceptions, external service down |
| Fatal | App cannot continue | Database unreachable, startup failure |
// ✅ Good — structured with named placeholders
logger.LogInformation("Order {OrderId} created for user {UserId}", orderId, userId);
// ❌ Bad — string interpolation destroys structure
logger.LogInformation($"Order {orderId} created for user {userId}");
app.Use(async (context, next) =>
{
var correlationId = context.Request.Headers["X-Correlation-ID"].FirstOrDefault()
?? Activity.Current?.Id
?? Guid.NewGuid().ToString();
using (LogContext.PushProperty("CorrelationId", correlationId))
{
context.Response.Headers["X-Correlation-ID"] = correlationId;
await next();
}
});
// In appsettings.json: override noisy or sensitive namespaces
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore.Database.Command": "Warning",
"System.Net.Http.HttpClient": "Warning"
}
}
}
[LogMasked] or destructuring policies for sensitive properties.Microsoft.AspNetCore to Warning to suppress noisy request logs.app.UseSerilogRequestLogging(options =>
{
options.EnrichDiagnosticContext = (diagnosticContext, httpContext) =>
{
diagnosticContext.Set("UserId",
httpContext.User.FindFirst(ClaimTypes.NameIdentifier)?.Value ?? "anonymous");
};
});
logger.LogInformation($"User {userId}") — kills structured loggingcatch (Exception ex) { /* silently swallowed */ } — always log or rethrowlogger.LogError(ex.Message) — log the full exception: logger.LogError(ex, "...")Information level for high-frequency operations (per-record in batch)tools
Build VS Code extensions with TypeScript. Covers extension anatomy, activation events, commands, tree views, webview panels, language features, testing, and publishing. Use when: creating a new VS Code extension, adding commands/views/providers, building webview UIs, implementing language server features, testing extensions, or packaging for the marketplace.
development
Track implementations, features, bugs, and releases in a versioning document. Use when: adding a commit, completing a feature, fixing a bug, or preparing a release. Automatically updates CHANGELOG.md following Keep a Changelog format and Semantic Versioning.
development
Write frontend tests using Vitest and React Testing Library. Use when: testing React components, hooks, user interactions, form submissions, accessibility assertions, or mocking API services.
development
Write Angular frontend tests using Jasmine, Karma, and Angular TestBed. Use when: testing Angular components, services, pipes, directives, user interactions, form submissions, accessibility assertions, or mocking HTTP services.