Recompute consumptions on SAP-Mougins-15 in tenant SLF + Add colors in LockingManager console logs
MODIFY
src/locking/LockingManager.ts
src/locking/LockingManager.ts
@@ -6,6 +6,7 @@ import LockingStorage from '../storage/mongodb/LockingStorage';
import Logging from '../utils/Logging';
import { ServerAction } from '../types/Server';
import Utils from '../utils/Utils';
+import chalk from 'chalk';
const MODULE_NAME = 'LockingManager';
@@ -40,7 +41,7 @@ export default class LockingManager {
message: `Acquired successfully the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}'`,
detailedMessages: { lock }
});
- Utils.isDevelopmentEnv() && console.debug(`Acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`);
+ Utils.isDevelopmentEnv() && console.debug(chalk.green(`Acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`));
return true;
} catch (error) {
await Logging.logWarning({
@@ -50,7 +51,7 @@ export default class LockingManager {
message: `Cannot acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID ${lock.tenantID}`,
detailedMessages: { lock, error: error.message, stack: error.stack }
});
- Utils.isDevelopmentEnv() && console.warn(`>>>>> Cannot acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`);
+ Utils.isDevelopmentEnv() && console.error(chalk.red(`Cannot acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`));
return false;
}
}
@@ -91,7 +92,7 @@ export default class LockingManager {
message: `Acquired successfully the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}'`,
detailedMessages: { lock }
});
- Utils.isDevelopmentEnv() && console.debug(`Acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`);
+ Utils.isDevelopmentEnv() && console.debug(chalk.green(`Acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`));
return true;
} catch (error) {
await Logging.logWarning({
@@ -101,7 +102,7 @@ export default class LockingManager {
message: `Cannot acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID ${lock.tenantID}`,
detailedMessages: { lock, error: error.message, stack: error.stack }
});
- Utils.isDevelopmentEnv() && console.warn(`>>>>> Cannot acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`);
+ Utils.isDevelopmentEnv() && console.error(chalk.red(`Cannot acquire the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`));
return false;
}
}
@@ -126,7 +127,7 @@ export default class LockingManager {
message: `Released successfully the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}'`,
detailedMessages: { lock }
});
- Utils.isDevelopmentEnv() && console.debug(`Released the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`);
+ Utils.isDevelopmentEnv() && console.debug(chalk.green(`Released the lock entity '${lock.entity}' ('${lock.key}') of type '${lock.type}' in Tenant ID '${lock.tenantID}'`));
return true;
}

MODIFY
src/migration/tasks/RecomputeAllTransactionsWithSimplePricingTask.ts
src/migration/tasks/RecomputeAllTransactionsWithSimplePricingTask.ts
@@ -35,6 +35,8 @@ export default class RecomputeAllTransactionsWithSimplePricingTask extends Migra
.aggregate([
{
$match: {
+ 'chargeBoxID':'SAP-Mougins-15',
+ 'timestamp': { $lt: new Date('2021-03-15') },
'stop.totalConsumptionWh': { $gt: 0 },
'stop.pricingSource': 'simple',
'refundData': { $exists: false },
@@ -104,7 +106,7 @@ export default class RecomputeAllTransactionsWithSimplePricingTask extends Migra
}
getVersion(): string {
- return '1.4';
+ return '1.5';
}
getName(): string {

Recompute consumptions on SAP-Mougins-15 in tenant SLF + Add colors in LockingManager console logs