Skills Plugins MCP Prompt Model 博客 我的中心

logging-best-practices

Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics

DeepseekModel 官方收录技能 质量 优秀 · 78 v1.0.0

获取

https://deepseekmodel.com/api/download.php?id=boristane-agent-skills-skills-logging-best-practices-skill-md&format=skill
下载 .skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用
.skill 文件中 system_prompt 字段的实际内容。
name logging-best-practices description Logging best practices focused on wide events (canonical log lines) for powerful debugging and analytics license MIT metadata {"author":"boristane","version":"1.0.0"} Logging Best Practices Skill Version: 1.0.0 Purpose This skill provides guidelines for implementing effective logging in applications. It focuses on wide events (also called canonical log lines) - a pattern where you emit a single, context-rich event per request per service, enabling powerful debugging and analytics. When to Apply Apply these guidelines when: Writing or reviewing logging code Adding console.log, logger.info, or similar Designing logging strategy for new services Setting up logging infrastructure Core Principles 1. Wide Events (CRITICAL) Emit one context-rich event per request per service . Instead of scattering log lines throughout your handler, consolidate everything into a single structured event emitted at request completion. const wideEvent : Record < string , unknown > = { method : 'POST' , path : '/checkout' , requestId : c. get ( 'requestId' ), timestamp : new Date (). toISOString (), }; try { const user = await getUser (c. get ( 'userId' )); wideEvent. user = { id : user. id , subscription : user. subscription }; const cart = await getCart (user. id ); wideEvent. cart = { total_cents : cart. total , item_count : cart. items . length }; wideEvent. status_code = 200 ; wideEvent. outcome = 'success' ; return c. json ({ success : true }); } catch (error) { wideEvent. status_code = 500 ; wideEvent. outcome = 'error' ; wideEvent. error = { message : error. message , type : error. name }; throw error; } finally { wideEvent. duration_ms = Date . now () - startTime; logger. info (wideEvent); } 2. High Cardinality & Dimensionality (CRITICAL) Include fields with high cardinality (user IDs, request IDs - millions of unique values) and high dimensionality (many fields per event). This enables querying by specific users and answering questions you haven't anticipated yet. 3. Business Context (CRITICAL) Always include business context: user subscription tier, cart value, feature flags, account age. The goal is to know "a premium customer couldn't complete a $2,499 purchase" not just "checkout failed." 4. Environment Characteristics (CRITICAL) Include environment and deployment info in every event: commit hash, service version, region, instance ID. This enables correlating issues with deployments and identifying region-specific problems. 5. Single Logger (HIGH) Use one logger instance configured at startup and import it everywhere. This ensures consistent formatting and automatic environment context. 6. Middleware Pattern (HIGH) Use middleware to handle wide event infrastructure (timing, status, environment, emission). Handlers should only add business context. 7. Structure & Consistency (HIGH) Use JSON format consistently Maintain consistent field names across services Simplify to two log levels: info and error Never log unstructured strings Anti-Patterns to Avoid Scattered logs : Multiple console.log() calls per request Multiple loggers : Different logger instances in different files Missing environment context : No commit hash or deployment info Missing business context : Logging technical details without user/business data Unstructured strings : console.log('something happened') instead of structured data Inconsistent schemas : Different field names across services Guidelines Wide Events ( rules/wide-events.md ) Emit one wide event per service hop Include all relevant context Connect events with request ID Emit at request completion in finally block Context ( rules/context.md ) Support high cardinality fields (user_id, request_id) Include high dimensionality (many fields) Always include business context Always include environment characteristics (commit_hash, version, region) Structure ( rules/structure.md ) Use a single logger throughout the codebase Use middleware for consistent wide events Use JSON format Maintain consistent schema Simplify to info and error levels Never log unstructured strings Common Pitfalls ( rules/pitfalls.md ) Avoid multiple log lines per request Design for unknown unknowns Always propagate request IDs across services References: Logging Sucks Observability Wide Events 101 Stripe - Canonical Log Lines
Agent 识别该技能的关键词,点击任意一个即可复制。

该技能未提供触发词。

下载的 .skill 包内含以下字段。
字段 说明
format格式标识(skill/v1)
skill_id技能唯一 ID
name技能名称
version版本号
description技能描述
category所属分类(数组)
trigger_words触发词列表
tags标签列表
source来源标识
source_url来源链接(本页地址)
exported_at导出时间(每次下载生成)
system_prompt系统提示词正文
model_config模型参数:provider / model / temperature / max_tokens / top_p
examples示例
install_guide各平台导入说明(Coze / Dify / Claude / 自定义框架)
同一份技能可按不同平台格式导出。
.skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用 下载
.skillpro 增强格式,额外含脚本 / 工具 / 依赖 / 钩子占位 下载
.json 纯 JSON 导出,只含 system_prompt 与模型参数 下载
Coze 带 frontmatter 的 Markdown,Coze 平台导入用 下载
Dify Dify DSL,创建应用后直接导入 下载

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。