csharp-logging

Guide structured ILogger<T> logging placement in C# services.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/RushuiGuan/claude --skill csharp-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-logging
Source: https://github.com/RushuiGuan/claude/tree/main/skills/csharp-logging
Command: npx skills add https://github.com/RushuiGuan/claude --skill csharp-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Logging is essential for diagnosing issues in C# services; without structured, thoughtful logs, incidents become hard to reproduce.

Core Features & Use Cases

  • Guides where to log: external calls, persisted state changes, and error paths.
  • Defines log levels and message phrasing to enable consistent, searchable logs.
  • Provides a setup pattern to inject ILogger<MyService> and avoid logging sensitive data.

Quick Start

Inject ILogger<MyService> into the service constructor and place structured log statements at the key points described in the guide.

Frequently Asked Questions about csharp-logging

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

FAQPage Schema
Where should I place logging statements in C# ASP.NET Core services?

Place C# logging statements around external calls, persisted state transitions, and swallowed exceptions to maximize diagnostic value during incident investigations or feature development.

How do I inject ILogger<T> correctly in a .NET 10 service?

Inject ILogger<T> into your service constructor using the concrete class name, such as ILogger<MyService>, to establish a structured logging setup pattern that ensures consistent, searchable log messages.

What is structured logging in C# and why is it needed for diagnostics?

Structured logging in C# defines specific log levels and message phrasing to create consistent, searchable logs, making incidents easier to reproduce and diagnose without losing critical diagnostic context.

How do I avoid logging sensitive data in dotnet applications?

Avoid logging sensitive data in dotnet by applying structured message phrasing guidelines that explicitly exclude sensitive information while writing clear messages at appropriate log levels.

Does this logging approach work for both feature development and incident investigation?

Yes, this logging approach applies across typical service patterns in ASP.NET Core or .NET 10 codebases, supporting both active feature development and retrospective incident investigation workflows.