application-logging by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill application-logging通过适当的级别、上下文和集中式聚合,实现全面的结构化日志记录,以进行有效的调试和监控。
最小化工作示例:
// logger.js
const winston = require("winston");
const logFormat = winston.format.combine(
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
winston.format.errors({ stack: true }),
winston.format.json(),
);
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || "info",
format: logFormat,
defaultMeta: {
service: "api-service",
environment: process.env.NODE_ENV || "development",
},
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple(),
),
}),
new winston.transports.File({
filename: "logs/error.log",
// ... (完整实现请参阅参考指南)
references/ 目录下的详细实现:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 指南 | 内容 |
|---|---|
| Node.js Structured Logging with Winston | 使用 Winston 进行 Node.js 结构化日志记录 |
| Express HTTP Request Logging | Express HTTP 请求日志记录 |
| Python Structured Logging | Python 结构化日志记录 |
| Flask Integration | Flask 集成 |
| ELK Stack Setup | ELK 堆栈设置 |
| Logstash Configuration | Logstash 配置 |
每周安装数
137
代码仓库
GitHub 星标数
116
首次出现
2026年1月21日
安全审计
安装于
opencode118
gemini-cli110
codex107
claude-code104
cursor100
github-copilot93
Implement comprehensive structured logging with proper levels, context, and centralized aggregation for effective debugging and monitoring.
Minimal working example:
// logger.js
const winston = require("winston");
const logFormat = winston.format.combine(
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
winston.format.errors({ stack: true }),
winston.format.json(),
);
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || "info",
format: logFormat,
defaultMeta: {
service: "api-service",
environment: process.env.NODE_ENV || "development",
},
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple(),
),
}),
new winston.transports.File({
filename: "logs/error.log",
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Node.js Structured Logging with Winston | Node.js Structured Logging with Winston |
| Express HTTP Request Logging | Express HTTP Request Logging |
| Python Structured Logging | Python Structured Logging |
| Flask Integration | Flask Integration |
| ELK Stack Setup | ELK Stack Setup |
| Logstash Configuration | Logstash Configuration |
Weekly Installs
137
Repository
GitHub Stars
116
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode118
gemini-cli110
codex107
claude-code104
cursor100
github-copilot93
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
130,600 周安装
AI邮件智能分类助手 - 自动处理收件箱,优先级排序与草拟回复
104 周安装
Cloudflare Wrangler CLI 指南:部署、开发和管理 Workers 全攻略
104 周安装
Instagram自动化工具:通过Rube MCP与Composio实现自动发帖与数据分析
104 周安装
AI代码安全指南 - Project CodeGuard软件安全技能,防止常见漏洞
104 周安装
Excel财务建模规范与xlsx文件处理指南 - 零错误公式与行业标准格式
104 周安装
MyVibe Publish:一键发布网页内容到MyVibe平台,支持HTML/ZIP/目录/URL
104 周安装