public logPrefix = (): string => {
return Utils.logPrefix(
` ${
- this?.stationInfo?.chargingStationId ??
- ChargingStationUtils.getChargingStationId(this.index, this.getTemplateFromFile())
+ (!Utils.isEmptyString(this?.stationInfo?.chargingStationId) &&
+ this?.stationInfo?.chargingStationId) ??
+ ChargingStationUtils.getChargingStationId(this.index, this.getTemplateFromFile()) ??
+ ''
} |`
);
};
): string {
// In case of multiple instances: add instance index to charging station id
const instanceIndex = process.env.CF_INSTANCE_INDEX ?? 0;
- const idSuffix = stationTemplate.nameSuffix ?? '';
+ const idSuffix = stationTemplate?.nameSuffix ?? '';
const idStr = `000000000${index.toString()}`;
return stationTemplate?.fixedName
? stationTemplate.baseName
[
OCPP16IncomingRequestCommand.RESET,
OCPP16ServiceUtils.parseJsonSchemaFile<ResetRequest>(
- '../../../assets/json-schemas/ocpp/1.6/Reset.json'
+ '../../../assets/json-schemas/ocpp/1.6/Reset.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CLEAR_CACHE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearCacheRequest>(
- '../../../assets/json-schemas/ocpp/1.6/ClearCache.json'
+ '../../../assets/json-schemas/ocpp/1.6/ClearCache.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
OCPP16ServiceUtils.parseJsonSchemaFile<UnlockConnectorRequest>(
- '../../../assets/json-schemas/ocpp/1.6/UnlockConnector.json'
+ '../../../assets/json-schemas/ocpp/1.6/UnlockConnector.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.GET_CONFIGURATION,
OCPP16ServiceUtils.parseJsonSchemaFile<GetConfigurationRequest>(
- '../../../assets/json-schemas/ocpp/1.6/GetConfiguration.json'
+ '../../../assets/json-schemas/ocpp/1.6/GetConfiguration.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
OCPP16ServiceUtils.parseJsonSchemaFile<ChangeConfigurationRequest>(
- '../../../assets/json-schemas/ocpp/1.6/ChangeConfiguration.json'
+ '../../../assets/json-schemas/ocpp/1.6/ChangeConfiguration.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
OCPP16ServiceUtils.parseJsonSchemaFile<GetDiagnosticsRequest>(
- '../../../assets/json-schemas/ocpp/1.6/GetDiagnostics.json'
+ '../../../assets/json-schemas/ocpp/1.6/GetDiagnostics.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
OCPP16ServiceUtils.parseJsonSchemaFile<SetChargingProfileRequest>(
- '../../../assets/json-schemas/ocpp/1.6/SetChargingProfile.json'
+ '../../../assets/json-schemas/ocpp/1.6/SetChargingProfile.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
OCPP16ServiceUtils.parseJsonSchemaFile<ClearChargingProfileRequest>(
- '../../../assets/json-schemas/ocpp/1.6/ClearChargingProfile.json'
+ '../../../assets/json-schemas/ocpp/1.6/ClearChargingProfile.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
OCPP16ServiceUtils.parseJsonSchemaFile<ChangeAvailabilityRequest>(
- '../../../assets/json-schemas/ocpp/1.6/ChangeAvailability.json'
+ '../../../assets/json-schemas/ocpp/1.6/ChangeAvailability.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<RemoteStartTransactionRequest>(
- '../../../assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json'
+ '../../../assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<RemoteStopTransactionRequest>(
- '../../../assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json'
+ '../../../assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16TriggerMessageRequest>(
- '../../../assets/json-schemas/ocpp/1.6/TriggerMessage.json'
+ '../../../assets/json-schemas/ocpp/1.6/TriggerMessage.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.DATA_TRANSFER,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferRequest>(
- '../../../assets/json-schemas/ocpp/1.6/DataTransfer.json'
+ '../../../assets/json-schemas/ocpp/1.6/DataTransfer.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16UpdateFirmwareRequest>(
- '../../../assets/json-schemas/ocpp/1.6/UpdateFirmware.json'
+ '../../../assets/json-schemas/ocpp/1.6/UpdateFirmware.json',
+ moduleName,
+ 'constructor'
),
],
]);
[
OCPP16RequestCommand.AUTHORIZE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16AuthorizeRequest>(
- '../../../assets/json-schemas/ocpp/1.6/Authorize.json'
+ '../../../assets/json-schemas/ocpp/1.6/Authorize.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.BOOT_NOTIFICATION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16BootNotificationRequest>(
- '../../../assets/json-schemas/ocpp/1.6/BootNotification.json'
+ '../../../assets/json-schemas/ocpp/1.6/BootNotification.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DiagnosticsStatusNotificationRequest>(
- '../../../assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json'
+ '../../../assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.HEARTBEAT,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16HeartbeatRequest>(
- '../../../assets/json-schemas/ocpp/1.6/Heartbeat.json'
+ '../../../assets/json-schemas/ocpp/1.6/Heartbeat.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.METER_VALUES,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16MeterValuesRequest>(
- '../../../assets/json-schemas/ocpp/1.6/MeterValues.json'
+ '../../../assets/json-schemas/ocpp/1.6/MeterValues.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.STATUS_NOTIFICATION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StatusNotificationRequest>(
- '../../../assets/json-schemas/ocpp/1.6/StatusNotification.json'
+ '../../../assets/json-schemas/ocpp/1.6/StatusNotification.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.START_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StartTransactionRequest>(
- '../../../assets/json-schemas/ocpp/1.6/StartTransaction.json'
+ '../../../assets/json-schemas/ocpp/1.6/StartTransaction.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.STOP_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StopTransactionRequest>(
- '../../../assets/json-schemas/ocpp/1.6/StopTransaction.json'
+ '../../../assets/json-schemas/ocpp/1.6/StopTransaction.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.DATA_TRANSFER,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferRequest>(
- '../../../assets/json-schemas/ocpp/1.6/DataTransfer.json'
+ '../../../assets/json-schemas/ocpp/1.6/DataTransfer.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16FirmwareStatusNotificationRequest>(
- '../../../assets/json-schemas/ocpp/1.6/FirmwareStatusNotification.json'
+ '../../../assets/json-schemas/ocpp/1.6/FirmwareStatusNotification.json',
+ moduleName,
+ 'constructor'
),
],
]);
[
OCPP16RequestCommand.BOOT_NOTIFICATION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16BootNotificationResponse>(
- '../../../assets/json-schemas/ocpp/1.6/BootNotificationResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/BootNotificationResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.HEARTBEAT,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16HeartbeatResponse>(
- '../../../assets/json-schemas/ocpp/1.6/HeartbeatResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/HeartbeatResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.AUTHORIZE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16AuthorizeResponse>(
- '../../../assets/json-schemas/ocpp/1.6/AuthorizeResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/AuthorizeResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.START_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StartTransactionResponse>(
- '../../../assets/json-schemas/ocpp/1.6/StartTransactionResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/StartTransactionResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.STOP_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StopTransactionResponse>(
- '../../../assets/json-schemas/ocpp/1.6/StopTransactionResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/StopTransactionResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.STATUS_NOTIFICATION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StatusNotificationResponse>(
- '../../../assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.METER_VALUES,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16MeterValuesResponse>(
- '../../../assets/json-schemas/ocpp/1.6/MeterValuesResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/MeterValuesResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DiagnosticsStatusNotificationResponse>(
- '../../../assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.DATA_TRANSFER,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferResponse>(
- '../../../assets/json-schemas/ocpp/1.6/DataTransferResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16FirmwareStatusNotificationResponse>(
- '../../../assets/json-schemas/ocpp/1.6/FirmwareStatusNotificationResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/FirmwareStatusNotificationResponse.json',
+ moduleName,
+ 'constructor'
),
],
]);
[
OCPP16IncomingRequestCommand.RESET,
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- '../../../assets/json-schemas/ocpp/1.6/ResetResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/ResetResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CLEAR_CACHE,
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- '../../../assets/json-schemas/ocpp/1.6/ClearCacheResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/ClearCacheResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
OCPP16ServiceUtils.parseJsonSchemaFile<ChangeAvailabilityResponse>(
- '../../../assets/json-schemas/ocpp/1.6/ChangeAvailabilityResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/ChangeAvailabilityResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
OCPP16ServiceUtils.parseJsonSchemaFile<UnlockConnectorResponse>(
- '../../../assets/json-schemas/ocpp/1.6/UnlockConnectorResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/UnlockConnectorResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.GET_CONFIGURATION,
OCPP16ServiceUtils.parseJsonSchemaFile<GetConfigurationResponse>(
- '../../../assets/json-schemas/ocpp/1.6/GetConfigurationResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/GetConfigurationResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
OCPP16ServiceUtils.parseJsonSchemaFile<ChangeConfigurationResponse>(
- '../../../assets/json-schemas/ocpp/1.6/ChangeConfigurationResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/ChangeConfigurationResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
OCPP16ServiceUtils.parseJsonSchemaFile<SetChargingProfileResponse>(
- '../../../assets/json-schemas/ocpp/1.6/SetChargingProfileResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/SetChargingProfileResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
OCPP16ServiceUtils.parseJsonSchemaFile<ClearChargingProfileResponse>(
- '../../../assets/json-schemas/ocpp/1.6/ClearChargingProfileResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/ClearChargingProfileResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- '../../../assets/json-schemas/ocpp/1.6/RemoteStartTransactionResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/RemoteStartTransactionResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- '../../../assets/json-schemas/ocpp/1.6/RemoteStopTransactionResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/RemoteStopTransactionResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
OCPP16ServiceUtils.parseJsonSchemaFile<GetDiagnosticsResponse>(
- '../../../assets/json-schemas/ocpp/1.6/GetDiagnosticsResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/GetDiagnosticsResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16TriggerMessageResponse>(
- '../../../assets/json-schemas/ocpp/1.6/TriggerMessageResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/TriggerMessageResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.DATA_TRANSFER,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferResponse>(
- '../../../assets/json-schemas/ocpp/1.6/DataTransferResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16UpdateFirmwareResponse>(
- '../../../assets/json-schemas/ocpp/1.6/UpdateFirmwareResponse.json'
+ '../../../assets/json-schemas/ocpp/1.6/UpdateFirmwareResponse.json',
+ moduleName,
+ 'constructor'
),
],
]);
!cpReplaced && chargingStation.getConnectorStatus(connectorId)?.chargingProfiles?.push(cp);
}
- public static parseJsonSchemaFile<T extends JsonType>(relativePath: string): JSONSchemaType<T> {
+ public static parseJsonSchemaFile<T extends JsonType>(
+ relativePath: string,
+ moduleName?: string,
+ methodName?: string
+ ): JSONSchemaType<T> {
return super.parseJsonSchemaFile<T>(
path.resolve(path.dirname(fileURLToPath(import.meta.url)), relativePath),
- OCPPVersion.VERSION_16
+ OCPPVersion.VERSION_16,
+ moduleName,
+ methodName
);
}
[
OCPP20IncomingRequestCommand.CLEAR_CACHE,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheRequest>(
- '../../../assets/json-schemas/ocpp/2.0/ClearCacheRequest.json'
+ '../../../assets/json-schemas/ocpp/2.0/ClearCacheRequest.json',
+ moduleName,
+ 'constructor'
),
],
]);
[
OCPP20RequestCommand.BOOT_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationRequest>(
- '../../../assets/json-schemas/ocpp/2.0/BootNotificationRequest.json'
+ '../../../assets/json-schemas/ocpp/2.0/BootNotificationRequest.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP20RequestCommand.HEARTBEAT,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatRequest>(
- '../../../assets/json-schemas/ocpp/2.0/HeartbeatRequest.json'
+ '../../../assets/json-schemas/ocpp/2.0/HeartbeatRequest.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP20RequestCommand.STATUS_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationRequest>(
- '../../../assets/json-schemas/ocpp/2.0/StatusNotificationRequest.json'
+ '../../../assets/json-schemas/ocpp/2.0/StatusNotificationRequest.json',
+ moduleName,
+ 'constructor'
),
],
]);
[
OCPP20RequestCommand.BOOT_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationResponse>(
- '../../../assets/json-schemas/ocpp/2.0/BootNotificationResponse.json'
+ '../../../assets/json-schemas/ocpp/2.0/BootNotificationResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP20RequestCommand.HEARTBEAT,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatResponse>(
- '../../../assets/json-schemas/ocpp/2.0/HeartbeatResponse.json'
+ '../../../assets/json-schemas/ocpp/2.0/HeartbeatResponse.json',
+ moduleName,
+ 'constructor'
),
],
[
OCPP20RequestCommand.STATUS_NOTIFICATION,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationResponse>(
- '../../../assets/json-schemas/ocpp/2.0/StatusNotificationResponse.json'
+ '../../../assets/json-schemas/ocpp/2.0/StatusNotificationResponse.json',
+ moduleName,
+ 'constructor'
),
],
]);
[
OCPP20IncomingRequestCommand.CLEAR_CACHE,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheResponse>(
- '../../../assets/json-schemas/ocpp/2.0/ClearCacheResponse.json'
+ '../../../assets/json-schemas/ocpp/2.0/ClearCacheResponse.json',
+ moduleName,
+ 'constructor'
),
],
]);
import { OCPPServiceUtils } from '../OCPPServiceUtils';
export class OCPP20ServiceUtils extends OCPPServiceUtils {
- public static parseJsonSchemaFile<T extends JsonType>(relativePath: string): JSONSchemaType<T> {
+ public static parseJsonSchemaFile<T extends JsonType>(
+ relativePath: string,
+ moduleName?: string,
+ methodName?: string
+ ): JSONSchemaType<T> {
return super.parseJsonSchemaFile<T>(
path.resolve(path.dirname(fileURLToPath(import.meta.url)), relativePath),
- OCPPVersion.VERSION_20
+ OCPPVersion.VERSION_20,
+ moduleName,
+ methodName
);
}
}
protected static parseJsonSchemaFile<T extends JsonType>(
filePath: string,
- ocppVersion: OCPPVersion
+ ocppVersion: OCPPVersion,
+ moduleName?: string,
+ methodName?: string
): JSONSchemaType<T> {
try {
return JSON.parse(fs.readFileSync(filePath, 'utf8')) as JSONSchemaType<T>;
filePath,
FileType.JsonSchema,
error as NodeJS.ErrnoException,
- OCPPServiceUtils.logPrefix(ocppVersion),
+ OCPPServiceUtils.logPrefix(ocppVersion, moduleName, methodName),
{ throwError: false }
);
}
: numberValue * options.unitMultiplier;
}
- private static logPrefix = (ocppVersion: OCPPVersion): string => {
- return Utils.logPrefix(` OCPP ${ocppVersion} |`);
+ private static logPrefix = (
+ ocppVersion: OCPPVersion,
+ moduleName?: string,
+ methodName?: string
+ ): string => {
+ const logMsg =
+ !Utils.isEmptyString(moduleName) && !Utils.isEmptyString(methodName)
+ ? ` OCPP ${ocppVersion} | ${moduleName}.${methodName}:`
+ : ` OCPP ${ocppVersion} |`;
+ return Utils.logPrefix(logMsg);
};
}
public logPrefix = (modName?: string, methodName?: string, prefixSuffix?: string): string => {
const logMsgPrefix = prefixSuffix ? `UI HTTP Server ${prefixSuffix}` : 'UI HTTP Server';
const logMsg =
- modName && methodName ? ` ${logMsgPrefix} | ${modName}.${methodName}:` : ` ${logMsgPrefix} |`;
+ !Utils.isEmptyString(modName) && !Utils.isEmptyString(methodName)
+ ? ` ${logMsgPrefix} | ${modName}.${methodName}:`
+ : ` ${logMsgPrefix} |`;
return Utils.logPrefix(logMsg);
};
? `UI WebSocket Server ${prefixSuffix}`
: 'UI WebSocket Server';
const logMsg =
- modName && methodName ? ` ${logMsgPrefix} | ${modName}.${methodName}:` : ` ${logMsgPrefix} |`;
+ !Utils.isEmptyString(modName) && !Utils.isEmptyString(methodName)
+ ? ` ${logMsgPrefix} | ${modName}.${methodName}:`
+ : ` ${logMsgPrefix} |`;
return Utils.logPrefix(logMsg);
};