diff --git a/lib/utils/logger/log_settings.js b/lib/utils/logger/log_settings.js index ae38580660..1b52760da8 100644 --- a/lib/utils/logger/log_settings.js +++ b/lib/utils/logger/log_settings.js @@ -1,103 +1,96 @@ -const lodashClone = require('lodash.clone'); - -const Settings = { - outputEnabled: true, - showResponseHeaders: false, - showRequestData: { - enabled: true, - trimLongScripts: true - }, - detailedOutput: true, - disableErrorLog: false, - log_timestamp: false, - timestamp_format: null, - enabled: true -}; - -module.exports = new (function() { - const logSettings = lodashClone(Settings, true); - - class LogSettings { - get outputEnabled() { - return logSettings.outputEnabled; - } +class LogSettings { + constructor() { + this.__outputEnabled = true; + this.__showResponseHeaders = false; + this.__showRequestData = { + enabled: true, + trimLongScripts: true + }, + this.__detailedOutput = true; + this.__disableErrorLog = false; + this.__log_timestamp = false; + this.__timestamp_format = null; + this.__enabled = true; + this.__htmlReporterEnabled = false; + } - get detailedOutput() { - return logSettings.detailedOutput; - } + get outputEnabled() { + return this.__outputEnabled; + } - get showRequestData() { - return logSettings.showRequestData; + set outputEnabled(value) { + if (typeof value == 'undefined') { + value = true; } - get enabled() { - return logSettings.enabled; - } + this.__outputEnabled = value; + } - get showResponseHeaders() { - return logSettings.showResponseHeaders; - } + get showResponseHeaders() { + return this.__showResponseHeaders; + } - get timestampFormat() { - return logSettings.timestamp_format; - } + get showRequestData() { + return this.__showRequestData; + } - set outputEnabled(value) { - if (typeof value == 'undefined') { - value = true; - } + get detailedOutput() { + return this.__detailedOutput; + } - logSettings.outputEnabled = value; - } + set detailedOutput(value) { + this.__detailedOutput = value; + } - set detailedOutput(value) { - logSettings.detailedOutput = value; + set disableErrorLog(value) { + if (typeof value == 'undefined') { + value = true; } - set disableErrorLog(value) { - if (typeof value == 'undefined') { - value = true; - } - - logSettings.disableErrorLog = value; - } + this.__disableErrorLog = value; + } - set htmlReporterEnabled(value) { - logSettings.htmlReporterEnabled = value; - } + get timestampFormat() { + return this.__timestamp_format; + } - get htmlReporterEnabled() { - return logSettings.htmlReporterEnabled; - } + get enabled() { + return this.__enabled; + } - isLogTimestamp() { - return logSettings.log_timestamp; - } + get htmlReporterEnabled() { + return this.__htmlReporterEnabled; + } - isErrorLogEnabled() { - return !logSettings.disableErrorLog; - } + set htmlReporterEnabled(value) { + this.__htmlReporterEnabled = value; + } - disable() { - logSettings.enabled = false; - } + isLogTimestamp() { + return this.__log_timestamp; + } - enable() { - logSettings.enabled = true; - } + isErrorLogEnabled() { + return !this.__disableErrorLog; + } - setLogTimestamp(val, format) { - logSettings.log_timestamp = val; - logSettings.timestamp_format = format; - } + disable() { + this.__enabled = false; + } - setHttpLogOptions({showRequestData, showResponseHeaders}) { - logSettings.showRequestData = showRequestData; - logSettings.showResponseHeaders = showResponseHeaders; - } + enable() { + this.__enabled = true; + } + setLogTimestamp(val, format) { + this.__log_timestamp = val; + this.__timestamp_format = format; + } + setHttpLogOptions({showRequestData, showResponseHeaders}) { + this.__showRequestData = showRequestData; + this.__showResponseHeaders = showResponseHeaders; } +} - return new LogSettings(); -})(); \ No newline at end of file +module.exports = new LogSettings();