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:
Krystie
2026-05-01 02:24:59 -07:00
parent ea5acfa9a2
commit 2f1e2107bc
3 changed files with 9 additions and 6 deletions

View File

@@ -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;
}