Add server name in perfs logs
MODIFY
src/assets/schemas/performance/performance.json
src/assets/schemas/performance/performance.json
"host": {
"type": "string"
},
+ "server": {
+ "type": "string"
+ },
"action": {
"type": "string"
},

MODIFY
src/start.ts
src/start.ts
@@ -149,7 +149,7 @@ export default class Bootstrap {
global.serverName = serverStarted[0];
}
// Log
- await this.logDuration(startTimeGlobalMillis, `${serverStarted.join(', ')} e-Mobility server has been started successfuly`);
+ await this.logDuration(startTimeGlobalMillis, `> ${serverStarted.join(', ')} > Server has been started successfuly`);
} catch (error) {
console.error(chalk.red(error));
await Logging.logError({

MODIFY
src/types/Performance.ts
src/types/Performance.ts
@@ -6,6 +6,7 @@ export default interface PerformanceRecord {
host: string;
action: ServerAction|string;
group: PerformanceRecordGroup;
+ server?: string;
durationMs?: number;
reqSizeKb?: number;
resSizeKb?: number;

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -29,6 +29,7 @@ import bcrypt from 'bcryptjs';
import cfenv from 'cfenv';
import chalk from 'chalk';
import fs from 'fs';
+import global from '../types/GlobalType';
import http from 'http';
import moment from 'moment';
import os from 'os';
@@ -1562,6 +1563,9 @@ export default class Utils {
if (params.httpResponseCode) {
performanceRecord.httpResponseCode = params.httpResponseCode;
}
+ if (global.serverName) {
+ performanceRecord.server = global.serverName;
+ }
return performanceRecord;
}

Add server name in perfs logs