[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FGMBK3559SP65SA9K8H5S5":3,"skill-same:01M6FGMBK3559SP65SA9K8H5S5":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6FGMBK3559SP65SA9K8H5S5","logging-best-practices",null,"Structured logging with proper levels, context, PII handling, centralized aggregation. Use for application logging, log management integration, distributed tracing, or encountering log bloat, PII exposure, missing context errors.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fsecondsky\u002Fclaude-skills\u002Flogging-best-practices\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"best practices","logging","logging best practices","errors","distributed","with","structured logging","missing","log management","structured","application","log","use","management","context","pii","aggregation","integration","tracing","distributed tracing","2026-11-10 10:12:30",false,"---\nname: logging-best-practices\ndescription: Structured logging with proper levels, context, PII handling, centralized aggregation. Use for application logging, log management integration, distributed tracing, or encountering log bloat, PII exposure, missing context errors.\nlicense: MIT\n---\n\n# Logging Best Practices\n\nImplement secure, structured logging with proper levels and context.\n\n## Log Levels\n\n| Level | Use For | Production |\n|-------|---------|------------|\n| DEBUG | Detailed debugging | Off |\n| INFO | Normal operations | On |\n| WARN | Potential issues | On |\n| ERROR | Errors with recovery | On |\n| FATAL | Critical failures | On |\n\n## Structured Logging (Winston)\n\n```javascript\nconst winston = require('winston');\n\nconst logger = winston.createLogger({\n  level: process.env.LOG_LEVEL || 'info',\n  format: winston.format.combine(\n    winston.format.timestamp(),\n    winston.format.json()\n  ),\n  defaultMeta: { service: 'api-service' },\n  transports: [\n    new winston.transports.Console(),\n    new winston.transports.File({ filename: 'error.log', level: 'error' })\n  ]\n});\n\n\u002F\u002F Usage\nlogger.info('User logged in', { userId: '123', ip: '192.168.1.1' });\nlogger.error('Payment failed', { error: err.message, orderId: '456' });\n```\n\n## Request Context\n\n```javascript\nconst { AsyncLocalStorage } = require('async_hooks');\nconst storage = new AsyncLocalStorage();\n\napp.use((req, res, next) => {\n  const context = {\n    requestId: req.headers['x-request-id'] || uuid(),\n    userId: req.user?.id\n  };\n  storage.run(context, next);\n});\n\nfunction log(level, message, meta = {}) {\n  const context = storage.getStore() || {};\n  logger.log(level, message, { ...context, ...meta });\n}\n```\n\n## PII Sanitization\n\n```javascript\nconst sensitiveFields = ['password', 'ssn', 'creditCard', 'token'];\n\nfunction sanitize(obj) {\n  const sanitized = { ...obj };\n  for (const field of sensitiveFields) {\n    if (sanitized[field]) sanitized[field] = '[REDACTED]';\n  }\n  if (sanitized.email) {\n    sanitized.email = sanitized.email.replace(\u002F(.{2}).*@\u002F, '$1***@');\n  }\n  return sanitized;\n}\n```\n\n## Best Practices\n\n- Use structured JSON format\n- Include correlation IDs across services\n- Sanitize all PII before logging\n- Use async logging for performance\n- Implement log rotation\n- Never log at DEBUG in production\n\n## Additional Implementations\n\nSee [references\u002Fadvanced-logging.md](references\u002Fadvanced-logging.md) for:\n- Python structlog setup\n- Go zap high-performance logging\n- ELK Stack integration\n- AWS CloudWatch configuration\n- OpenTelemetry tracing\n\n## Never Do\n\n- Log passwords or tokens\n- Use console.log in production\n- Log inside tight loops\n- Include stack traces for client errors\n","# Logging Best Practices\n\nImplement secure, structured logging with proper levels and context.\n\n## Log Levels\n\n| Level | Use For | Production |\n|-------|---------|------------|\n| DEBUG | Detailed debugging | Off |\n| INFO | Normal operations | On |\n| WARN | Potential issues | On |\n| ERROR | Errors with recovery | On |\n| FATAL | Critical failures | On |\n\n## Structured Logging (Winston)\n\n```javascript\nconst winston = require('winston');\n\nconst logger = winston.createLogger({\n  level: process.env.LOG_LEVEL || 'info',\n  format: winston.format.combine(\n    winston.format.timestamp(),\n    winston.format.json()\n  ),\n  defaultMeta: { service: 'api-service' },\n  transports: [\n    new winston.transports.Console(),\n    new winston.transports.File({ filename: 'error.log', level: 'error' })\n  ]\n});\n\n\u002F\u002F Usage\nlogger.info('User logged in', { userId: '123', ip: '192.168.1.1' });\nlogger.error('Payment failed', { error: err.message, orderId: '456' });\n```\n\n## Request Context\n\n```javascript\nconst { AsyncLocalStorage } = require('async_hooks');\nconst storage = new AsyncLocalStorage();\n\napp.use((req, res, next) => {\n  const context = {\n    requestId: req.headers['x-request-id'] || uuid(),\n    userId: req.user?.id\n  };\n  storage.run(context, next);\n});\n\nfunction log(level, message, meta = {}) {\n  const context = storage.getStore() || {};\n  logger.log(level, message, { ...context, ...meta });\n}\n```\n\n## PII Sanitization\n\n```javascript\nconst sensitiveFields = ['password', 'ssn', 'creditCard', 'token'];\n\nfunction sanitize(obj) {\n  const sanitized = { ...obj };\n  for (const field of sensitiveFields) {\n    if (sanitized[field]) sanitized[field] = '[REDACTED]';\n  }\n  if (sanitized.email) {\n    sanitized.email = sanitized.email.replace(\u002F(.{2}).*@\u002F, '$1***@');\n  }\n  return sanitized;\n}\n```\n\n## Best Practices\n\n- Use structured JSON format\n- Include correlation IDs across services\n- Sanitize all PII before logging\n- Use async logging for performance\n- Implement log rotation\n- Never log at DEBUG in production\n\n## Additional Implementations\n\nSee [references\u002Fadvanced-logging.md](references\u002Fadvanced-logging.md) for:\n- Python structlog setup\n- Go zap high-performance logging\n- ELK Stack integration\n- AWS CloudWatch configuration\n- OpenTelemetry tracing\n\n## Never Do\n\n- Log passwords or tokens\n- Use console.log in production\n- Log inside tight loops\n- Include stack traces for client errors\n",{"name":5,"license":15,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fsecondsky\u002Fclaude-skills\u002Flogging-best-practices",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill logging-best-practices",{"tool":59,"command":60},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill logging-best-practices",{"tool":62,"command":63},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill logging-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fsecondsky\u002Fclaude-skills\u002Flogging-best-practices\u002FSKILL.md",true,[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fadvanced-logging.md","REFERENCE","参考文档",6580,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fsecondsky\u002Fclaude-skills\u002Flogging-best-practices\u002Freferences\u002Fadvanced-logging.md",[74,88,98,107,113,120],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":84,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[79],{"categoryNo":80,"categoryName":81,"taxonomyType":82,"taxonomyTypeDesc":83},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[85,86,87],"model","model hierarchy","model hierarchy skill",{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":94,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[93],{"categoryNo":80,"categoryName":81,"taxonomyType":82,"taxonomyTypeDesc":83},[95,96,97],"MCP","zoom","zoom mcp",{"skillNo":99,"name":100,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[104,105,106,96],"sdk","zoom apps sdk","apps",{"skillNo":108,"name":109,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[109],{"skillNo":114,"name":115,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":119,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[118],{"categoryNo":80,"categoryName":81,"taxonomyType":82,"taxonomyTypeDesc":83},[115],{"skillNo":121,"name":122,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[122]]