Application logging

From aj-geddes/useful-ai-prompts · View interactive version

Application logging is an AI agent skill from the GitHub repository aj-geddes/useful-ai-prompts. Implement structured logging across applications with log aggregation and centralized analysis. Use when setting up application logging, implementing ELK stack, or analyzing application behavior.

How to use this skill

Skill file

Application Logging

Table of Contents

Overview

Implement comprehensive structured logging with proper levels, context, and centralized aggregation for effective debugging and monitoring.

When to Use

Quick Start

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)

Reference Guides

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 |

Best Practices

✅ DO

❌ DON'T

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.