Skip to content

Commit

Permalink
Enhance logging
Browse files Browse the repository at this point in the history
- debug log enabled by default
  • Loading branch information
DrJume committed Sep 2, 2018
1 parent 401b308 commit c2b0df6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion helpers/read-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { recursiveObjPatch } = require('util/object-tools')
const DefaultConfig = {
webserver: { port: 8000, log_debug_tty: false, log_file: false },
updater: { pre_release: false },
dev: { silence_debug_log: true },
dev: { silence_debug_log: false },
}

module.exports = async function readConfig(configPath) {
Expand Down
3 changes: 2 additions & 1 deletion lib/VplanParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ const VplanParser = {
return undefined
}

log.info('DETECTING_QUEUEDAY_BY_DATE_CALC')
log.info('AUTO_SCHEDULING', `${transformedVplanJSObj.type}: [${queueDateString}]`)
log.debug('QUEUEDAY_BY_DATE_CALC')

const today = moment()
log.debug('QUEUEDATE', queueDate)
Expand Down
2 changes: 1 addition & 1 deletion routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function readVplan(queueDay, vplanType) {
)
if (err) {
if (err.code === 'ENOENT') {
log.warn('NO_VPLAN_AVAILABLE', `${queueDay}/${vplanType}`)
log.debug('NO_VPLAN_AVAILABLE', `${queueDay}/${vplanType}`)
} else {
log.err('FILE_READ_ERR', err)
}
Expand Down
11 changes: 8 additions & 3 deletions services/UploadWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ module.exports = async function UploadWatcher(callback) {
}
}
})
.on('change', async (filePath) => {
if (path.extname(filePath) === '.json') {
log.info('VPLAN_FILE_UPDATED', filePath)
}
})
.on('add', async (filePath) => {
log.debug('FILE_DETECTED', filePath)

Expand All @@ -69,7 +74,7 @@ module.exports = async function UploadWatcher(callback) {
return
}

log.info('USING_JSON_FILE', filePath)
log.info('VPLAN_FILE_LOADED', filePath)
return
}

Expand Down Expand Up @@ -97,8 +102,8 @@ module.exports = async function UploadWatcher(callback) {

// manual upload
if (['current', 'next'].includes(uploadLocation)) {
log.info('MANUAL_UPLOAD')
log.info('DETECTING_QUEUEDAY_BY_UPLOAD_DIR')
log.info('MANUAL_SCHEDULING', `${transformedVplanData.type}: [${transformedVplanData.head.title.trim()}]`)
log.debug('QUEUEDAY_BY_UPLOAD_DIR')

callback(uploadLocation, transformedVplanData, vplanType)
return
Expand Down

0 comments on commit c2b0df6

Please sign in to comment.