一键导入
logging-patterns
Logging conventions — level usage, formatting style, structured output.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Logging conventions — level usage, formatting style, structured output.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
MCP tool error response format — canonical error object, standard codes, retry semantics.
Run any question, idea, or decision through a council of 5 AI advisors who independently analyze it, peer-review each other anonymously, and synthesize a final verdict. Based on Karpathy's LLM Council methodology. MANDATORY TRIGGERS: 'council this', 'run the council', 'war room this', 'pressure-test this', 'stress-test this', 'debate this'. STRONG TRIGGERS (use when combined with a real decision or tradeoff): 'should I X or Y', 'which option', 'what would you do', 'is this the right move', 'validate this', 'get multiple perspectives', 'I can't decide', 'I'm torn between'. Do NOT trigger on simple yes/no questions, factual lookups, or casual 'should I' without a meaningful tradeoff (e.g. 'should I use markdown' is not a council question). DO trigger when the user presents a genuine decision with stakes, multiple options, and context that suggests they want it pressure-tested from multiple angles.
How agents, skills, and commands work in this project.
Documentation writing conventions — style, structure, tone, and quality standards.
CSS design system principles — token usage, semantic layering, mobile-first, component isolation.
GitHub conventions — branch naming, commit format, issue/PR templates, and safe issue/PR referencing in comments.
| name | logging-patterns |
| description | Logging conventions — level usage, formatting style, structured output. |
| when_to_use | Writing code that logs events, configuring log output, or choosing log levels. |
| user-invocable | false |
One logger per module, at module level:
import logging
logger = logging.getLogger(__name__)
Use %s-style formatting arguments, not f-strings — the message template is preserved for structured aggregator queries:
logger.info("Cleaned up %d expired sessions", count) # yes
logger.error("SMTP send failed for %s", email, exc_info=True) # yes
logger.info(f"Cleaned up {count} expired sessions") # no
| Level | Use for |
|---|---|
DEBUG | Cache hit/miss, slow-path internals (opt-in only) |
INFO | Startup/shutdown, admin bootstrap, cleanup counts, rate limit hits |
WARNING | Recoverable anomalies, swallowed exceptions, degraded operation |
ERROR | Unexpected exceptions on operational paths — always with exc_info=True |
CRITICAL | Reserved for unusable state |
One record per line on stdout. Let the container runtime (Docker, k8s) capture it — no file sinks or log rotation in-app.
Support two formats via config:
plain — Readable for local devjson — Stable single-line object per record for log aggregators (Loki, Datadog, ELK, CloudWatch)Timestamps in UTC in both formats.