Skip to content

Commit 058d331

Browse files
committed
Adding debug level logs about config validation
1 parent 96ec6fe commit 058d331

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/helpers/configValidator.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
const Ajv = require('ajv');
22
const metaSchema = require('ajv/lib/refs/json-schema-draft-06.json');
3+
const logger = require('./logger');
34
const configSchema = require('./schemas/config.schema.json');
45

56
const ajv = new Ajv({ logger: false, allErrors: true });
67
ajv.addMetaSchema(metaSchema);
78
const validator = ajv.addSchema(configSchema, 'config');
89

910
function validateConfig(config) {
11+
logger.debug('Validating config file');
1012
const valid = validator.validate('config', config);
1113
const errors = ajv.errorsText(validator.errors, { dataVar: 'config' });
1214
if (!valid) throw new Error(`Error(s) found in config file: ${errors}`);
15+
logger.debug('Config file validated successfully');
1316
}
1417

1518
module.exports = {

0 commit comments

Comments
 (0)