Assist_Design/docs/LOGGING_LEVELS.md
T. Narantuya 0f7d680782 Update throttler configuration and enhance logging setup
- Adjusted authentication rate limit TTL from 15 minutes to 10 minutes for stricter control.
- Improved logging configuration to reduce noise by ignoring specific HTTP requests and customizing serializers.
- Refactored logging in checkout components to utilize useCallback for better performance and removed unnecessary console logs.
2025-09-01 18:47:30 +09:00

2.4 KiB

📊 Logging Configuration Guide

Quick Log Level Changes

# Check current level
./scripts/set-log-level.sh

# Set to minimal logging (production-like)
./scripts/set-log-level.sh warn

# Set to normal development logging
./scripts/set-log-level.sh info

# Set to detailed debugging
./scripts/set-log-level.sh debug

Manual Configuration

Edit .env file:

LOG_LEVEL="info"  # Change this value

Log Levels Explained

Level Numeric What You'll See Best For
error 0 Only critical errors Production monitoring
warn 1 Warnings + errors Quiet development
info 2 General operations Normal development
debug 3 Detailed debugging Troubleshooting issues
trace 4 Very verbose tracing Deep debugging

What's Been Optimized

Reduced Noise

  • HTTP requests/responses: Filtered out health checks, static assets
  • Request bodies: Hidden by default (security + noise reduction)
  • Response bodies: Hidden by default (reduces overwhelming output)
  • Session checks: Frequent /api/auth/session calls ignored

Cleaner Output

  • Pretty formatting: Colored, timestamped logs in development
  • Message focus: Emphasizes actual log messages over metadata
  • Structured data: Still available but not overwhelming

Security Enhanced

  • Sensitive data: Automatically redacted (tokens, passwords, etc.)
  • Production ready: No debug info exposed to customers

Common Scenarios

🔇 Too Much Noise?

./scripts/set-log-level.sh warn

🐛 Debugging Issues?

./scripts/set-log-level.sh debug

🚀 Normal Development?

./scripts/set-log-level.sh info

📊 Production Monitoring?

./scripts/set-log-level.sh error

Environment Variables

# Core logging
LOG_LEVEL="info"                    # Main log level
DISABLE_HTTP_LOGGING="false"        # Set to "true" to disable HTTP logs entirely

# Application context
APP_NAME="customer-portal-bff"      # Service name in logs
NODE_ENV="development"              # Affects log formatting

Restart Required

After changing log levels, restart your development server:

# Stop current server (Ctrl+C)
# Then restart
pnpm dev

The new log level will take effect immediately.