logging-standards-ai-kit

Standardize .NET logging with structured events, log levels, and PII protection.

Updated May 11, 2026
One-click install
npx skills add https://github.com/ducthang-hub/nw-ai-kit --skill logging-standards-ai-kit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-standards-ai-kit
Source: https://github.com/ducthang-hub/nw-ai-kit/tree/main/.agents/skills/logging-standards-ai-kit
Command: npx skills add https://github.com/ducthang-hub/nw-ai-kit --skill logging-standards-ai-kit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents noisy or unsafe .NET logging by standardizing structured logging, correct log levels, PII handling, and exception practices so logs remain useful in production and APM tools.

Core Features & Use Cases

  • Structured logging over string interpolation to make properties searchable in Datadog/APM.
  • PII and sensitive data protection so prohibited personal data never appears in logs or Datadog.
  • Consistent log levels and scope/context enrichment to reduce noise, preserve performance, and correlate events across requests and operations.
  • Exception handling guidance to preserve stack traces and add operational context without leaking sensitive data.

Quick Start

Ask the AI: "Show me how to log my .NET request and exception using structured fields, correct log levels, PII masking rules, and a scope that includes TransId and AccountNumber."

Frequently Asked Questions about logging-standards-ai-kit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement structured logging in .NET without exposing PII?

Structured logging in .NET without exposing PII is achieved by using structured fields over string interpolation and applying non-PII logging rules. This ensures sensitive data is masked while keeping properties searchable in APM tools.

What is the best way to correlate logs across requests using Serilog and ILogger?

Correlating logs across requests using Serilog and ILogger is done through log scopes and context enrichment. This preserves operational context like TransId across operations, reducing noise and maintaining performance.

Does this approach to .NET logging help with Datadog discoverability?

Yes, this .NET logging approach improves Datadog discoverability by enforcing structured events and safe context propagation. It standardizes severity mapping and searchable properties so APM tools can index and correlate logs effectively.

Why should I use structured fields instead of string interpolation in .NET logging?

You should use structured fields instead of string interpolation in .NET logging because it makes properties searchable in Datadog and APM tools. String interpolation flattens data into unsearchable text, reducing log utility in production troubleshooting.

How do I handle exceptions in .NET logs without leaking sensitive data?

Handling exceptions in .NET logs without leaking sensitive data requires preserving stack traces while adding operational context. This Skill enforces safe object serialization and non-PII logging rules during exception handling to prevent sensitive data exposure.

When do I need log scopes and enrichment in .NET applications?

You need log scopes and enrichment in .NET applications when you must correlate events across requests and operations. Scopes reduce noise and preserve performance by attaching contextual data like TransId to structured logs without repetitive manual passing.