fix: Improve logging - fix LOG_LEVEL filter, reduce HTTP noise
- Fix LOG_LEVEL filtering logic (was inverted) - HTTP logs now only show errors (4xx, 5xx) by default - Add database connection check at startup - Cron jobs logged on separate lines - LOG_LEVEL=debug shows all HTTP requests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
24
src/index.js
24
src/index.js
@@ -1,11 +1,25 @@
|
||||
import app from './app.js';
|
||||
import { startAllCronJobs } from './cron/index.js';
|
||||
import { logger } from './utils/logger.js';
|
||||
import { testConnection } from './config/database.js';
|
||||
|
||||
const port = process.env.PORT || 5000;
|
||||
app.listen(port, () => {
|
||||
logger.info(`Server running on http://localhost:${port}`);
|
||||
|
||||
// Start cron jobs after server is running
|
||||
startAllCronJobs();
|
||||
});
|
||||
const start = async () => {
|
||||
try {
|
||||
// Test database connection
|
||||
await testConnection();
|
||||
logger.success('Database connected');
|
||||
|
||||
// Start server
|
||||
app.listen(port, () => {
|
||||
logger.info(`Server running on http://localhost:${port}`);
|
||||
startAllCronJobs();
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error('Failed to start server', error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
start();
|
||||
|
||||
Reference in New Issue
Block a user