serilog

serilog is a skill for Claude Code, Codex from znlgis/opengis-skills. It costs 79 tokens per session (4,069 once invoked), scanned A, original, MIT.

A structured logging library for .NET applications. It records messages with named values, then writes them as text or JSON to places such as the console or files.

In plain words
What is it for?
Use it to configure application and request logging, send logs to console or files, read logging settings from appsettings.json, and connect logging to .NET dependency injection.
Why use it?
It avoids losing useful details in plain text messages and helps diagnose missing output, duplicate ASP.NET Core request logs, and formatting problems.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to configure application and request logging, send logs to console or files, read logging settings from appsettings.json, and connect logging to .NET dependency injection.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/znlgis/opengis-skills/serilog
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add znlgis/opengis-skills --skill serilog
Clone the repo
git clone --depth 1 https://github.com/znlgis/opengis-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for serilog

README.md
[![agentmods](https://agentmods.dev/badge/skills/znlgis/opengis-skills/serilog/github.svg)](https://agentmods.dev/skills/znlgis/opengis-skills/serilog)
Your own site
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/serilog"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/serilog/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for serilog

Your own site · 80×15
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/serilog"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/serilog.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 79 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,069 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00079 $0.04069
Opus 5.5 $0.00032 $0.01628
Sonnet 5.5 $0.00016 $0.00814
Haiku 4.5 $0.00008 $0.00407

Measured 2d ago against content hash ad7e13b94e97, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

serilog scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s -o /dev/null -w "%{http_code}\n" http://localhost:5080/api/health
csharp/serilog/SKILL.md · 400 lines

How it starts

The opening of the file, as written. The whole thing — 400 lines — stays where its author put it; the contents beside it link to each section on GitHub.

项目地址: https://github.com/serilog/serilog

官方文档: https://serilog.net/

NuGet: Serilog(核心,4.4.0);Serilog.AspNetCore(10.0.0,版本跟随 Microsoft.Extensions.Hosting)

常用配套包: Serilog.Sinks.Console 6.1.1 / Serilog.Sinks.File 7.0.0 / Serilog.Settings.Configuration 10.0.1 / Serilog.Formatting.Compact 3.0.0(截至 2026-10,NuGet)

目标框架: net8.0 / net9.0 / net10.0 / netstandard2.0 / .NET Framework 4.6.2+

许可证: Apache-2.0

概述

Serilog 是 .NET 的结构化日志库:日志事件不是先拼成字符串,而是保留具名属性与值,再交给 sink 渲染成文本或 JSON。核心包 Serilog 只负责管道与事件模型,输出能力全部由 sink 包提供。

  • 结构化事件:消息模板 "Processed {@Position} in {Elapsed} ms" 记录 Position / Elapsed 两个属性
  • sink 可组合:控制台、文件、Seq、OpenTelemetry、Elasticsearch 等都通过 WriteTo.* 挂载
  • 配置驱动:ReadFrom.Configuration(IConfiguration) 支持在 appsettings.json 中声明 sink 与级别
  • ASP.NET Core 一等公民:Serilog.AspNetCore 把框架自身的 ILogger 输出接入 Serilog 管道,并提供单事件请求日志中间件
  • 低开销:级别关闭时几乎不产生分配(Log.Logger 的 IsEnabled 短路)

日志管道的两个关键概念:

概念 作用 典型 API
Logger 事件入口,决定最小级别与 enricher new LoggerConfiguration().MinimumLevel.Debug()
Sink 事件出口,决定写入哪里、什么格式 .WriteTo.Console() / .WriteTo.File(...)

安装

方式一:dotnet CLI(推荐)

# ASP.NET Core 项目:一个包带齐核心 + Console/File/Debug sink + 配置绑定
dotnet add package Serilog.AspNetCore

# 控制台 / Worker / 类库
dotnet add package Serilog
dotnet add package Serilog.Sinks.Console
dotnet add package Serilog.Sinks.File

方式二:PackageReference 直接写 csproj

<ItemGroup>
  <PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
  <PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
  <PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
</ItemGroup>

方式三:Visual Studio 包管理器控制台

Install-Package Serilog.AspNetCore -Version 10.0.0

验证安装

dotnet list package | grep -i serilog

控制台最小可运行验证(不依赖任何宿主):

using Serilog;

using var log = new LoggerConfiguration()
    .WriteTo.Console()
    .CreateLogger();

log.Information("Hello, Serilog!");

Read the full file on GitHub · 400 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 400 lines · 79 tokens per session scan A ad7e13b94e97

Subscribe to this mod's changes

serilog is a skill published in the GitHub repository znlgis/opengis-skills (76 stars, last pushed 3d ago), licensed MIT. It adds 79 tokens to every session and 4,069 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-28.