From: charleswrayjr Date: Mon, 8 Sep 2025 18:07:12 +0000 (-0500) Subject: Testing vpn paths. X-Git-Url: https://git.phasecustomsoft.com/?a=commitdiff_plain;h=d137ac1b18605282f7a52294624a7c7f188f94e0;p=phs-api.git Testing vpn paths. --- diff --git a/app.js b/app.js index 7503355..f3022a4 100755 --- a/app.js +++ b/app.js @@ -50,7 +50,7 @@ app.use(cookieParser()); const logger = log4js.default; // Set log level based on the active environment for global logger -logger.level = 'warn'; +logger.level = 'debug'; switch (process.env.PHS_ENV) { case 'DEV': diff --git a/src/controllers/vpn.controller.js b/src/controllers/vpn.controller.js index bc79fec..a0f95c1 100644 --- a/src/controllers/vpn.controller.js +++ b/src/controllers/vpn.controller.js @@ -11,7 +11,9 @@ const parseVpnStatus = ( output ) => { const lines = output.split( '\n' ).map( line => line.trim() ).filter( Boolean ); const lValues = [ 'lines:', lines ].join( ' ' ); + logger.debug( lValues ); logger.warn( lValues ); + logger.error( lValues ); // Find indices using a single pass let sIndex = -1, mIndex = -1, eIndex = -1; lines.forEach( ( line, i ) => { diff --git a/src/middleware/loggerMiddleWare.js b/src/middleware/loggerMiddleWare.js index 59d6def..effd0aa 100755 --- a/src/middleware/loggerMiddleWare.js +++ b/src/middleware/loggerMiddleWare.js @@ -15,31 +15,27 @@ log4js.configure({ numBackups: 3 }, out: { + type: 'stdout' + }, + errorAppender: { + level: 'WARN', + maxLevel: 'FATAL', type: 'stdout', - layout: { - type: "pattern", + layout:{ + type:"pattern", // %highlight{} conversion word for colorization - pattern: '%[%d{yyyy-MM-dd hh:mm:ss.SSS} %p %c %f:%l%] %m%n', + pattern:'%[%d{yyyy-MM-dd hh:mm:ss.SSS} %p %c %f:%l%] %m%n', // Default highlight colors for common levels (optional, but good practice) // You can customize these or add more specific level-color mappings - highlight: { - FATAL: 'red', - ERROR: 'red', - WARN: 'yellow', - INFO: 'green', - DEBUG: 'blue', - TRACE: 'cyan' + highlight:{ + FATAL:'red', + ERROR:'red', + WARN:'yellow', + INFO:'green', + DEBUG:'blue', + TRACE:'cyan' } - /*pattern: "[%d{ISO8601}] [%p] - %f:%l %m%n --", // Pattern including file and line number - highlight: { - FATAL: 'red', - ERROR: 'red', - WARN: 'yellow', - INFO: 'green', - DEBUG: 'blue', - TRACE: 'cyan' - }*/ - }, + } }, errorFile: { type: "file",