Enforce singleton design pattern for the logger
[e-mobility-charging-stations-simulator.git] / src / performance / storage / Storage.ts
index db33a694777e5efe0e415bf96c2874b7ad434cba..80906699dff10ce6667f05a8c73eb59e53de6208 100644 (file)
@@ -5,7 +5,7 @@ import { DBName, StorageType } from '../../types/Storage';
 import Statistics from '../../types/Statistics';
 import { URL } from 'url';
 import Utils from '../../utils/Utils';
-import logger from '../../utils/Logger';
+import getLogger from '../../utils/Logger';
 
 export abstract class Storage {
   protected readonly storageUri: URL;
@@ -18,7 +18,7 @@ export abstract class Storage {
   }
 
   protected handleDBError(type: StorageType, error: Error, table?: string): void {
-    logger.error(`${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${error.message}'${(!Utils.isNullOrUndefined(table) || !table) && ` in table or collection '${table}'`}: %j`, error);
+    getLogger().error(`${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${error.message}'${(!Utils.isNullOrUndefined(table) || !table) && ` in table or collection '${table}'`}: %j`, error);
   }
 
   protected getDBNameFromStorageType(type: StorageType): DBName {