timestamps in logs, aligned with other daemons
This commit is contained in:
@@ -10,6 +10,18 @@ import express from 'express'
|
|||||||
import session from 'express-session'
|
import session from 'express-session'
|
||||||
import connectMySQL from 'express-mysql-session'
|
import connectMySQL from 'express-mysql-session'
|
||||||
|
|
||||||
|
const originalLog = console.log
|
||||||
|
const originalWarn = console.warn
|
||||||
|
const originalError = console.error
|
||||||
|
function logWithTimestamp(originalFn, level, ...args) {
|
||||||
|
const timestamp = new Date().toISOString()
|
||||||
|
originalFn(`[${timestamp}] [${level}]`, ...args)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log = (...args) => logWithTimestamp(originalLog, 'LOG', ...args)
|
||||||
|
console.warn = (...args) => logWithTimestamp(originalWarn, 'WARN', ...args)
|
||||||
|
console.error = (...args) => logWithTimestamp(originalError, 'ERROR', ...args)
|
||||||
|
|
||||||
const argv = yargs(hideBin(process.argv)).command('wssGateway', 'Redis <=> Websocket message bus gateway', {})
|
const argv = yargs(hideBin(process.argv)).command('wssGateway', 'Redis <=> Websocket message bus gateway', {})
|
||||||
.options({
|
.options({
|
||||||
'argv.debug': {
|
'argv.debug': {
|
||||||
|
|||||||
Reference in New Issue
Block a user