Overview
Development environments benefit from verbose logging to help debug issues and understand application behavior. This guide shows how to configure HTTP Ledger for optimal development experience.Development Configuration
Full Logging Setup
Capture all request and response details:Comparing Environments
Environment-Based Configuration
Automatically adjust settings based onNODE_ENV:
Debugging Specific Routes
Enable detailed logging only for routes under development:Local File Logging
Save logs to a file for later analysis:Pretty-Printed Console Output
Format logs for better readability in the console:Testing Error Scenarios
Log detailed error information during development:Integration with Nodemon
Add scripts to yourpackage.json:
nodemon.json configuration:
Complete Development Example
Tips for Development
- Enable
logBodyandlogResponseto see full request/response data - Use
autoGenerateRequestIdto track requests across your application - Set
logSamplingto1.0(or omit it) to log every request - Use
customFormatterto add visual cues and make logs more readable - Log to files with
onLogfor analysis after testing