Add comprehensive logging infrastructure with configuration and middleware

- Implemented centralized logging utility using Winston with daily log rotation
- Added logging middleware for request and error tracking
- Extended .env.example with logging configuration options
- Updated app configuration to support flexible logging settings
- Replaced console.log with structured logging in main application entry point
- Created logging middleware to capture request details and response times
This commit is contained in:
jango-blockchained
2025-02-03 15:41:06 +01:00
parent 397355c1ad
commit 1753e35cd3
6 changed files with 305 additions and 6 deletions

View File

@@ -48,4 +48,26 @@ CORS_ORIGINS=http://localhost:3000,http://localhost:8123
TEST_HASS_HOST=http://localhost:8123
TEST_HASS_TOKEN=test_token
TEST_HASS_SOCKET_URL=ws://localhost:8123/api/websocket
TEST_PORT=3001
TEST_PORT=3001
# Security Configuration
JWT_SECRET=your-secret-key
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000 # 15 minutes
RATE_LIMIT_MAX=100
# SSE Configuration
SSE_MAX_CLIENTS=1000
SSE_PING_INTERVAL=30000
# Logging Configuration
LOG_LEVEL=info
LOG_DIR=logs
LOG_MAX_SIZE=20m
LOG_MAX_DAYS=14d
LOG_COMPRESS=true
LOG_REQUESTS=true
# Version
VERSION=0.1.0