home / skills / andrelandgraf / fullstackrecipes / pino-logging-setup
This skill configures Pino logging with development friendly colorized output and production JSON for aggregation, boosting observability across apps.
npx playbooks add skill andrelandgraf/fullstackrecipes --skill pino-logging-setupReview the files below or copy the command above to add this skill to your agents.
---
name: pino-logging-setup
description: Configure structured logging with Pino. Outputs human-readable colorized logs in development and structured JSON in production for log aggregation services.
---
# Pino Logging Setup
To set up Pino Logging Setup, refer to the fullstackrecipes MCP server resource:
**Resource URI:** `recipe://fullstackrecipes.com/pino-logging-setup`
If the MCP server is not configured, fetch the recipe directly:
```bash
curl -H "Accept: text/plain" https://fullstackrecipes.com/api/recipes/pino-logging-setup
```
This skill configures structured logging with Pino for TypeScript full‑stack apps. It emits human‑readable, colorized logs in development and structured JSON in production so logs can be ingested by aggregation services. The setup includes sensible defaults, serializers, and environment detection to minimize manual tuning.
The skill provides a Pino configuration that switches transports and formatting based on NODE_ENV. In development it uses a pretty‑print transport with colors and readable timestamps. In production it disables pretty printing and emits compact JSON with consistent fields (level, time, pid, service, msg) and optional serializers for errors and request/response objects to keep logs parsable by downstream systems.
How do I switch between pretty and JSON output?
The config checks NODE_ENV and toggles the pretty transport; set NODE_ENV=production to enable JSON output.
Can I add custom fields to every log entry?
Yes. Attach a base object (for example service and version) to the logger so those fields appear on every record.
How should I handle error objects?
Use Pino serializers to extract message, stack, and code from Error instances to produce consistent, non‑circular JSON.