KB IN UPPERCASE
MODIFY
src/utils/Logging.ts
src/utils/Logging.ts
@@ -57,10 +57,10 @@ export default class Logging {
}
const sizeOfDataKB = Utils.truncTo(sizeof(data) / 1024, 2);
const numberOfRecords = Array.isArray(data) ? data.length : 0;
- const message = `${module}.${method} ${found ? '- ' + executionDurationMillis.toString() + 'ms' : ''} ${!Utils.isEmptyJSon(data) ? '- ' + sizeOfDataKB.toString() + 'kB' : ''} ${Array.isArray(data) ? '- ' + numberOfRecords.toString() + ' rec(s)' : ''}`;
+ const message = `${module}.${method} ${found ? '- ' + executionDurationMillis.toString() + 'ms' : ''} ${!Utils.isEmptyJSon(data) ? '- ' + sizeOfDataKB.toString() + 'KB' : ''} ${Array.isArray(data) ? '- ' + numberOfRecords.toString() + ' rec(s)' : ''}`;
Utils.isDevelopmentEnv() && console.debug(chalk.green(message));
if (sizeOfDataKB > Constants.PERF_MAX_DATA_VOLUME_KB) {
- const error = new Error(`Data must be < ${Constants.PERF_MAX_DATA_VOLUME_KB}kB, got ${sizeOfDataKB}kB`);
+ const error = new Error(`Data must be < ${Constants.PERF_MAX_DATA_VOLUME_KB}KB, got ${sizeOfDataKB}KB`);
await Logging.logWarning({
tenantID,
source: Constants.CENTRAL_SERVER,
@@ -315,10 +315,10 @@ export default class Logging {
if (res.getHeader('content-length')) {
sizeOfDataKB = Utils.truncTo(res.getHeader('content-length') as number / 1024, 2);
}
- const message = `Express HTTP Response - ${(executionDurationMillis > 0) ? executionDurationMillis : '?'} ms - ${(sizeOfDataKB > 0) ? sizeOfDataKB : '?'} kB >> ${req.method}/${res.statusCode} '${req.url}'`;
+ const message = `Express HTTP Response - ${(executionDurationMillis > 0) ? executionDurationMillis : '?'} ms - ${(sizeOfDataKB > 0) ? sizeOfDataKB : '?'} KB >> ${req.method}/${res.statusCode} '${req.url}'`;
Utils.isDevelopmentEnv() && console.debug(chalk.green(message));
if (sizeOfDataKB > Constants.PERF_MAX_DATA_VOLUME_KB) {
- const error = new Error(`Data must be < ${Constants.PERF_MAX_DATA_VOLUME_KB} kB, got ${(sizeOfDataKB > 0) ? sizeOfDataKB : '?'} kB`);
+ const error = new Error(`Data must be < ${Constants.PERF_MAX_DATA_VOLUME_KB} KB, got ${(sizeOfDataKB > 0) ? sizeOfDataKB : '?'} KB`);
await Logging.logWarning({
tenantID,
source: Constants.CENTRAL_SERVER,
@@ -415,7 +415,7 @@ export default class Logging {
if (response.config.headers['Content-Length']) {
sizeOfDataKB = Utils.truncTo(response.config.headers['Content-Length'] / 1024, 2);
}
- const message = `Axios HTTP Response - ${(executionDurationMillis > 0) ? executionDurationMillis : '?'} ms - ${(sizeOfDataKB > 0) ? sizeOfDataKB : '?'} kB << ${response.config.method.toLocaleUpperCase()}/${response.status} '${response.config.url}'`;
+ const message = `Axios HTTP Response - ${(executionDurationMillis > 0) ? executionDurationMillis : '?'} ms - ${(sizeOfDataKB > 0) ? sizeOfDataKB : '?'} KB << ${response.config.method.toLocaleUpperCase()}/${response.status} '${response.config.url}'`;
Utils.isDevelopmentEnv() && console.log(chalk.green(message));
if (sizeOfDataKB > Constants.PERF_MAX_DATA_VOLUME_KB) {
const error = new Error(`Data must be < ${Constants.PERF_MAX_DATA_VOLUME_KB}`);
@@ -487,7 +487,7 @@ export default class Logging {
await Logging.logSecurityDebug({
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}'`,
+ message: `Axios HTTP Response - ${(executionDurationMillis > 0) ? executionDurationMillis : '?'} ms - ${(sizeOfDataKB > 0) ? sizeOfDataKB : '?'} KB << ${response.config.method.toLocaleUpperCase()}/${response.status} '${response.config.url}'`,
module: MODULE_NAME, method: 'interceptor',
detailedMessages: {
status: response.status,

KB IN UPPERCASE