replace debug() with our custom logger

mostly we want trace() and log(). trace() can be enabled whenever
we want by flipping a flag and restarting box
This commit is contained in:
Girish Ramakrishnan
2026-03-12 22:55:28 +05:30
parent d57554a48c
commit 01d0c738bc
104 changed files with 1187 additions and 1174 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
import assert from 'node:assert';
import AuditSource from './auditsource.js';
import constants from './constants.js';
import debugModule from 'debug';
import logger from './logger.js';
import eventlog from './eventlog.js';
import express from 'express';
import http from 'node:http';
@@ -14,14 +14,14 @@ import users from './users.js';
import util from 'node:util';
import { WebSocketServer } from 'ws';
const debug = debugModule('box:server');
const { log, trace } = logger('server');
let gHttpServer = null;
function notFoundHandler(req, res, next) {
const cleanUrl = req.url.replace(/(access_token=)[^&]+/, '$1' + '<redacted>');
debug(`no such route: ${req.method} ${cleanUrl}`);
log(`no such route: ${req.method} ${cleanUrl}`);
return next(new HttpError(404, 'No such route'));
}
@@ -507,9 +507,9 @@ async function initializeExpressSync() {
async function start() {
assert(gHttpServer === null, 'Server is already up and running.');
debug('==========================================');
debug(` Cloudron ${constants.VERSION} `);
debug('==========================================');
log('==========================================');
log(` Cloudron ${constants.VERSION} `);
log('==========================================');
await platform.initialize();