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.isNotEmptyString(moduleName) && Utils.isNotEmptyString(methodName)
+ ? ` OCPP ${ocppVersion} | ${moduleName}.${methodName}:`
+ : ` OCPP ${ocppVersion} |`;
+ return Utils.logPrefix(logMsg);
+ };
}