Skip to content

Commit

Permalink
fix: startup error in setupLogging() (#96)
Browse files Browse the repository at this point in the history
Co-authored-by: Andreas Hochsteger <[email protected]>
  • Loading branch information
ahochsteger and ahochsteger authored Dec 21, 2020
1 parent a0365a9 commit 1b5c880
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,23 @@ function start (server) {
startGateway()
}

// use a function so we don't mess the default settings object
const defaultSettings = () => {
return {
gateway: {
logEnabled: true,
logLevel: 'info',
logToFile: false,
logFilename: 'zwavejs2mqtt.log'
}
}
}

function setupLogging (settings) {
loggers.setupAll({
enabled: settings.gateway.logEnabled,
level: settings.gateway.logLevel,
logToFile: settings.gateway.logToFile,
filename: settings.gateway.logFilename
})
settings = settings
? Object.assign(defaultSettings(), settings)
: defaultSettings()
loggers.setupAll(settings)
}

function startGateway () {
Expand Down

0 comments on commit 1b5c880

Please sign in to comment.