Application Logging

Application Logging

Guides an AI coding agent to add structured application logging with levels, context and central aggregation using Winston, Python logging and the ELK stack.

Skill files9 files

references/

scripts/

templates/

SKILL.md99 lines
1
---
2
name: application-logging
3
description: >
4
Implement structured logging across applications with log aggregation and
5
centralized analysis. Use when setting up application logging, implementing
6
ELK stack, or analyzing application behavior.
7
---
8
9
# Application Logging
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Implement comprehensive structured logging with proper levels, context, and centralized aggregation for effective debugging and monitoring.
22
23
## When to Use
24
25
- Application debugging
26
- Audit trail creation
27
- Performance analysis
28
- Compliance requirements
29
- Centralized log aggregation
30
31
## Quick Start
32
33
Minimal working example:
34
35
```javascript
36
// logger.js
37
const winston = require("winston");
38
39
const logFormat = winston.format.combine(
40
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
41
winston.format.errors({ stack: true }),
42
winston.format.json(),
43
);
44
45
const logger = winston.createLogger({
46
level: process.env.LOG_LEVEL || "info",
47
format: logFormat,
48
defaultMeta: {
49
service: "api-service",
50
environment: process.env.NODE_ENV || "development",
51
},
52
transports: [
53
new winston.transports.Console({
54
format: winston.format.combine(
55
winston.format.colorize(),
56
winston.format.simple(),
57
),
58
}),
59
new winston.transports.File({
60
filename: "logs/error.log",
61
// ... (see reference guides for full implementation)
62
```
63
64
## Reference Guides
65
66
Detailed implementations in the `references/` directory:
67
68
| Guide | Contents |
69
|---|---|
70
| [Node.js Structured Logging with Winston](references/nodejs-structured-logging-with-winston.md) | Node.js Structured Logging with Winston |
71
| [Express HTTP Request Logging](references/express-http-request-logging.md) | Express HTTP Request Logging |
72
| [Python Structured Logging](references/python-structured-logging.md) | Python Structured Logging |
73
| [Flask Integration](references/flask-integration.md) | Flask Integration |
74
| [ELK Stack Setup](references/elk-stack-setup.md) | ELK Stack Setup |
75
| [Logstash Configuration](references/logstash-configuration.md) | Logstash Configuration |
76
77
## Best Practices
78
79
### ✅ DO
80
81
- Use structured JSON logging
82
- Include request IDs for tracing
83
- Log at appropriate levels
84
- Add context to error logs
85
- Implement log rotation
86
- Use timestamps consistently
87
- Aggregate logs centrally
88
- Filter sensitive data
89
90
### ❌ DON'T
91
92
- Log passwords or secrets
93
- Log at INFO for every operation
94
- Use unstructured messages
95
- Ignore log storage limits
96
- Skip context information
97
- Log to stdout in production
98
- Create unbounded log files
99

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…