Add log rotation utility with file management and cleanup
- Implemented log rotation module with configurable size and age-based log management - Added utility functions to parse log file sizes and retention durations - Created methods for identifying, filtering, and cleaning up old log files - Integrated log rotation initialization in the main application entry point - Added periodic checks for log file size and age-based cleanup
This commit is contained in:
@@ -17,6 +17,7 @@ import { requestLogger, errorLogger } from './middleware/logging.middleware.js';
|
||||
import { get_hass } from './hass/index.js';
|
||||
import { LiteMCP } from 'litemcp';
|
||||
import { logger } from './utils/logger.js';
|
||||
import { initLogRotation } from './utils/log-rotation.js';
|
||||
|
||||
logger.info('Starting Home Assistant MCP...');
|
||||
logger.info('Initializing Home Assistant connection...');
|
||||
@@ -27,6 +28,9 @@ logger.info('Initializing Home Assistant connection...');
|
||||
*/
|
||||
const app = express();
|
||||
|
||||
// Initialize log rotation
|
||||
initLogRotation();
|
||||
|
||||
// Apply logging middleware first to catch all requests
|
||||
app.use(requestLogger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user