Added constants for modules
MODIFY
src/server/ocpp/json/JsonWSConnection.ts
src/server/ocpp/json/JsonWSConnection.ts
@@ -148,7 +148,7 @@ export default class JsonWSConnection extends WSConnection {
}
public async handleRequest(messageId: string, commandName: ServerAction, commandPayload: Record<string, unknown> | string): Promise<void> {
- await Logging.logChargingStationServerReceiveAction(MODULE_NAME, this.getTenantID(), this.getChargingStationID(), commandName, commandPayload);
+ await Logging.logChargingStationServerReceiveAction(Constants.MODULE_JSON_OCPP_SERVER, this.getTenantID(), this.getChargingStationID(), commandName, commandPayload);
const methodName = `handle${commandName}`;
// Check if method exist in the service
if (typeof this.chargingStationService[methodName] === 'function') {
@@ -158,7 +158,7 @@ export default class JsonWSConnection extends WSConnection {
// Call it
const result = await this.chargingStationService[methodName](this.headers, commandPayload);
// Log
- await Logging.logChargingStationServerRespondAction(MODULE_NAME, this.getTenantID(), this.getChargingStationID(), commandName, result);
+ await Logging.logChargingStationServerRespondAction(Constants.MODULE_JSON_OCPP_SERVER, this.getTenantID(), this.getChargingStationID(), commandName, result);
// Send Response
await this.sendMessage(messageId, result, OCPPMessageType.CALL_RESULT_MESSAGE, commandName);
} else {

MODIFY
src/server/ocpp/soap/services/SoapCentralSystemService12.ts
src/server/ocpp/soap/services/SoapCentralSystemService12.ts
@@ -7,7 +7,7 @@ import { ServerAction } from '../../../../types/Server';
import Utils from '../../../../utils/Utils';
import global from '../../../../types/GlobalType';
-const MODULE_NAME = 'SoapCentralSystemService12';
+const MODULE_NAME = 'SoapOcppServer12';
export default { /* Services */
CentralSystemService: { /* Ports */

MODIFY
src/server/ocpp/soap/services/SoapCentralSystemService15.ts
src/server/ocpp/soap/services/SoapCentralSystemService15.ts
@@ -7,7 +7,7 @@ import { ServerAction } from '../../../../types/Server';
import Utils from '../../../../utils/Utils';
import global from '../../../../types/GlobalType';
-const MODULE_NAME = 'SoapCentralSystemService15';
+const MODULE_NAME = 'SoapOcppServer15';
export default { /* Services */
CentralSystemService: { /* Ports */

MODIFY
src/server/ocpp/soap/services/SoapCentralSystemService16.ts
src/server/ocpp/soap/services/SoapCentralSystemService16.ts
@@ -7,7 +7,7 @@ import { ServerAction } from '../../../../types/Server';
import Utils from '../../../../utils/Utils';
import global from '../../../../types/GlobalType';
-const MODULE_NAME = 'SoapCentralSystemService16';
+const MODULE_NAME = 'SoapOcppServer16';
export default { /* Services */
CentralSystemService: { /* Ports */

MODIFY
src/utils/Constants.ts
src/utils/Constants.ts
@@ -251,6 +251,9 @@ export default class Constants {
public static readonly OICP_SERVER = 'OICP Server';
+ public static readonly MODULE_AXIOS = 'Axios';
+ public static readonly MODULE_JSON_OCPP_SERVER = 'JsonOcppServer';
+
// OICP constants
public static readonly OICP_PROGRESS_NOTIFICATION_MAX_INTERVAL = 300; // Hubject restriction: "Progress Notification can be sent only at interval of at least 300 seconds." (5 Minutes)
public static readonly OICP_VIRTUAL_USER_EMAIL = 'virtual@oicp.com';

MODIFY
src/utils/Logging.ts
src/utils/Logging.ts
@@ -397,7 +397,7 @@ export default class Logging {
tenantID: tenantID,
action: ServerAction.HTTP_REQUEST,
message: `Axios HTTP Request >> ${request.method.toLocaleUpperCase()} '${request.url}'`,
- module: 'Axios', method: 'interceptor',
+ module: Constants.MODULE_AXIOS, method: 'interceptor',
detailedMessages: {
request: Utils.cloneObject(request),
}
@@ -423,7 +423,7 @@ export default class Logging {
tenantID,
source: Constants.CENTRAL_SERVER,
action: ServerAction.PERFORMANCES,
- module: 'Axios', method: 'logAxiosResponse',
+ module: Constants.MODULE_AXIOS, method: 'logAxiosResponse',
message: `${message}: ${error.message}`,
detailedMessages: { error: error.stack }
});
@@ -441,7 +441,7 @@ export default class Logging {
tenantID,
source: Constants.CENTRAL_SERVER,
action: ServerAction.PERFORMANCES,
- module: 'Axios', method: 'logAxiosResponse',
+ module: Constants.MODULE_AXIOS, method: 'logAxiosResponse',
message: `${message}: ${error.message}`,
detailedMessages: { error: error.stack }
});
@@ -458,7 +458,7 @@ export default class Logging {
tenantID: tenantID,
action: ServerAction.HTTP_RESPONSE,
message,
- module: 'Axios', method: 'logAxiosResponse',
+ module: Constants.MODULE_AXIOS, method: 'logAxiosResponse',
detailedMessages: {
status: response.status,
statusText: response.statusText,
@@ -477,7 +477,7 @@ export default class Logging {
durationMs: executionDurationMillis,
sizeKb: sizeOfDataKB,
source: Constants.AXIOS_CLIENT,
- module: 'Axios', method: 'logAxiosResponse',
+ module: Constants.MODULE_AXIOS, method: 'logAxiosResponse',
action: ServerAction.HTTP_RESPONSE,
})
);
@@ -487,7 +487,7 @@ export default class Logging {
tenantID: tenantID,
action: ServerAction.HTTP_RESPONSE,
message: `Axios HTTP Response - ${(executionDurationMillis > 0) ? executionDurationMillis : '?'} ms - ${(sizeOfDataKB > 0) ? sizeOfDataKB : '?'} KB << ${response.config.method.toLocaleUpperCase()}/${response.status} '${response.config.url}'`,
- module: 'Axios', method: 'logAxiosResponse',
+ module: Constants.MODULE_AXIOS, method: 'logAxiosResponse',
detailedMessages: {
status: response.status,
statusText: response.statusText
@@ -502,7 +502,7 @@ export default class Logging {
tenantID: tenantID,
action: ServerAction.HTTP_ERROR,
message: `Axios HTTP Error >> ${error.config?.method?.toLocaleUpperCase()}/${error.response?.status} '${error.config?.url}' - ${error.message}`,
- module: 'Axios', method: 'interceptor',
+ module: Constants.MODULE_AXIOS, method: 'interceptor',
detailedMessages: {
url: error.config?.url,
status: error.response?.status,

Added constants for modules