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:
+6
-6
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user