fix: replace console.log/console.error with proper logging in monitoring and themes routes
- monitoring.js: Added log dependency, replaced console.log with log.warn - themes.js: Added log dependency, replaced console.error with log.error - src/app.js: Pass log to monitoringRoutes and themesRoutes This fixes error messages being lost to stdout instead of proper log files.
This commit is contained in:
@@ -8,9 +8,10 @@ const { ValidationError, NotFoundError } = require('../errors');
|
||||
* Themes routes factory
|
||||
* @param {Object} deps - Explicit dependencies
|
||||
* @param {Function} deps.asyncHandler - Async route handler wrapper
|
||||
* @param {Object} deps.log - Logger instance
|
||||
* @returns {express.Router}
|
||||
*/
|
||||
module.exports = function({ asyncHandler }) {
|
||||
module.exports = function({ asyncHandler, log }) {
|
||||
const router = express.Router();
|
||||
const THEMES_DIR = process.env.THEMES_DIR || path.join(path.dirname(process.env.SERVICES_FILE || '/app/services.json'), 'themes');
|
||||
|
||||
@@ -29,7 +30,7 @@ module.exports = function({ asyncHandler }) {
|
||||
themes[slug] = data;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[Themes] Failed to read themes:', e.message);
|
||||
log.error('themes', 'Failed to read themes', { error: e.message });
|
||||
}
|
||||
return themes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user