| supervisionUrls | | [] | string \| string[] | string or array of global connection URIs to OCPP-J servers |
| supervisionUrlDistribution | round-robin/random/charging-station-affinity | charging-station-affinity | boolean | supervision urls distribution policy to simulated charging stations |
| logStatisticsInterval | | 60 | integer | seconds between charging stations statistics output in the logs |
+| logEnabled | true/false | true | boolean | enable logging |
| logConsole | true/false | false | boolean | output logs on the console |
| logFormat | | simple | string | [winston](https://github.com/winstonjs/winston) log format |
| logRotate | true/false | true | boolean | enable daily log files rotation |
/** @deprecated Moved to worker configuration section. */
chargingStationsPerWorker?: number;
logStatisticsInterval?: number;
+ logEnabled?: boolean;
+ logConsole?: boolean;
logFormat?: string;
logLevel?: string;
logRotate?: boolean;
logMaxSize?: number | string;
logFile?: string;
logErrorFile?: string;
- logConsole?: boolean;
};
return Configuration.getWorker().processType === WorkerProcessType.dynamicPool;
}
+ public static getLogEnabled(): boolean | undefined {
+ return Utils.hasOwnProp(Configuration.getConfig(), 'logEnabled')
+ ? Configuration.getConfig()?.logEnabled
+ : true;
+ }
+
public static getLogConsole(): boolean | undefined {
Configuration.warnDeprecatedConfigurationKey(
'consoleLog',
import type { FormatWrap } from 'logform';
-import { type Logger, createLogger, format, type transport } from 'winston';
+import { createLogger, format, type transport } from 'winston';
import TransportType from 'winston/lib/winston/transports/index.js';
import DailyRotateFile from 'winston-daily-rotate-file';
];
}
-export const logger: Logger = createLogger({
+export const logger = createLogger({
+ silent: !Configuration.getLogEnabled(),
level: Configuration.getLogLevel(),
format: format.combine(format.splat(), (format[Configuration.getLogFormat()] as FormatWrap)()),
transports,