dev-structured-logs

Migrate legacy string-based .NET logging to structured message templates.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/innexar-plat/Master-Coat-Solutions --skill dev-structured-logs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dev-structured-logs
Source: https://github.com/innexar-plat/Master-Coat-Solutions/tree/main/.github/skills/dev-structured-logs
Command: npx skills add https://github.com/innexar-plat/Master-Coat-Solutions --skill dev-structured-logs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Legacy .NET logging often uses string concatenation or interpolation, producing unstructured messages that are hard to query and correlate. This skill modernizes ILogger and Serilog calls to structured message templates and ensures proper Serilog file sink JSON configuration.

Core Features & Use Cases

  • Structured Logging Migration: parses C# files and rewrites log calls from concatenated strings, String.Format, or interpolated strings into message templates with named properties.
  • CommandHandler Scope Insertion: optionally adds BeginScope blocks that capture command identifiers such as Id, UserId, TransactionId for richer correlation.
  • Serilog File Sink Configuration: detects Serilog package references and updates appsettings JSON files to use JSON file sinks with a custom formatter and correct file extensions.
  • Safe Dry‑Run Workflow: generates a unified diff and a preview report for review before any changes are applied, with backup and optional git commit.

Quick Start

Use dev-structured-logs to run a dry‑run migration of logging in your repository and apply the changes after review.

Frequently Asked Questions about dev-structured-logs

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

FAQPage Schema
How do I convert legacy .NET string interpolation logging to structured message templates?

To convert legacy .NET logging to structured message templates, run the structured logs migration script against your C# repository, which parses and rewrites concatenated or interpolated ILogger and Serilog calls into named property templates.

Can I preview Serilog and ILogger structured logging changes before applying them to my C# project?

Yes, you can preview structured logging changes by executing the migration script in dry-run mode, which generates a unified diff and a detailed report for review before modifying any files or creating a git commit.

How does the Serilog file sink configuration get updated for structured JSON logging?

The migration updates Serilog file sink configurations by detecting package references and modifying appsettings JSON files to use JSON file sinks with a custom formatter and correct file extensions for structured output.

Does this structured logging migration tool support adding command handler scopes for correlation?

Yes, the tool supports adding command handler scopes by optionally inserting BeginScope blocks that capture command identifiers like Id, UserId, and TransactionId for richer log correlation during the rewrite process.

What is the best way to migrate large C# repositories to structured logging without breaking existing functionality?

The safest way to migrate large C# repositories is using the dry-run workflow to generate a diff preview, then applying changes with automatic backups and optional git commits to ensure structured logging adoption remains reversible.

Do I need Python installed to run the structured logging migration on .NET projects?

Yes, you need Python installed to execute the structured_logs script, which requires a repository path and optional flags for dry-run, apply, handler scope, and configuration enforcement to process C# files.