一键导入
dck-serilog
Use when configuring AHKFlowApp Serilog, structured logging, sinks, enrichers, request logging, or Application Insights.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when configuring AHKFlowApp Serilog, structured logging, sinks, enrichers, request logging, or Application Insights.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when creating, removing, or troubleshooting AHKFlowApp git worktrees across Claude Code, Codex, or Copilot.
Use when optimizing AHKFlowApp agent workflow, worktrees, planning, verification loops, context budget, or tool usage.
Use when verifying AHKFlowApp build, tests, formatting, diagnostics, security, or readiness before commit, push, or PR.
Compact the current conversation into a handoff document for another agent to pick up.
Use to scan .NET code for performance anti-patterns across async, memory, strings, collections, LINQ, regex, and I/O.
Use to evaluate assertion depth and diversity across a test suite and flag assertion-free, shallow, or tautological tests.
| name | dck-serilog |
| description | Use when configuring AHKFlowApp Serilog, structured logging, sinks, enrichers, request logging, or Application Insights. |
AHKFlowApp already uses two-stage Serilog startup in src/Backend/AHKFlowApp.API/Program.cs, AddSerilog(...), UseSerilogRequestLogging(...), console/file sinks, and optional Application Insights when ApplicationInsights:ConnectionString is configured.
CreateBootstrapLogger() before building the host.{Property} placeholders over string interpolation.appsettings*.json or App Service configuration.Log.CloseAndFlushAsync().logger.LogInformation(
"Generated AutoHotkey script for profile {ProfileId} with {HotstringCount} hotstrings",
profileId,
hotstringCount);
For exceptions:
logger.LogError(ex, "Failed to generate script for profile {ProfileId}", profileId);
Use UseSerilogRequestLogging after exception middleware and before route execution where practical. Enrich with request metadata that is useful and safe:
app.UseSerilogRequestLogging(options =>
{
options.EnrichDiagnosticContext = (diagnosticContext, httpContext) =>
{
diagnosticContext.Set("RequestHost", httpContext.Request.Host.Value);
diagnosticContext.Set("UserAgent", httpContext.Request.Headers.UserAgent.ToString());
};
});
Application Insights is conditional in this repo. Keep the connection string empty for local development and inject it through Azure App Service configuration for TEST/PROD.
Do not upgrade Microsoft.ApplicationInsights.AspNetCore to 3.x unless the user explicitly asks; project guidance keeps it on 2.x.
Use LogContext.PushProperty(...) for scoped properties that should flow through multiple log events:
using (LogContext.PushProperty("OwnerOid", ownerOid))
{
logger.LogInformation("Importing hotstrings");
}
$"User {userId} did X" instead of "User {UserId} did X".| Scenario | Pattern |
|---|---|
| Startup errors | Bootstrap logger |
| Per-request summary | UseSerilogRequestLogging |
| Queryable event data | Message templates |
| TEST/PROD telemetry | App Service config + Application Insights sink |
| Repeated context | LogContext.PushProperty |
| Hot path logging | Consider [LoggerMessage] |