From e1dc442f20c78fcc65e19afaf5f0f8410bbcc31d Mon Sep 17 00:00:00 2001 From: Ricky Boyce Date: Sat, 11 Jun 2022 17:05:59 +1200 Subject: [PATCH] fix: warnings printing by default --- lib/index.js | 2 +- lib/model-crud.js | 2 +- lib/model.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index c11d828..f27d068 100644 --- a/lib/index.js +++ b/lib/index.js @@ -44,7 +44,7 @@ module.exports = function(uri, opts, fn) { manager.model = require('./model') manager.models = models manager.parseData = util.parseData.bind(util) - manager.warn = debug('monastery:warn') + manager.warn = debug('monastery:warn*') manager.error = debug('monastery:error*') manager.info = debug('monastery:info') diff --git a/lib/model-crud.js b/lib/model-crud.js index 95b8844..1016b82 100644 --- a/lib/model-crud.js +++ b/lib/model-crud.js @@ -238,7 +238,7 @@ module.exports = { await util.runSeries(this.beforeUpdate.map(f => f.bind(opts, data||{}))) if (data && operators['$set']) { - this.warn(`'$set' fields take precedence over the data fields for \`${this.name}.${type}()\``) + this.info(`'$set' fields take precedence over the data fields for \`${this.name}.${type}()\``) } if (data || operators['$set']) { operators['$set'] = { ...data, ...(operators['$set'] || {}) } diff --git a/lib/model.js b/lib/model.js index f014a5a..1b790ee 100644 --- a/lib/model.js +++ b/lib/model.js @@ -86,7 +86,7 @@ let Model = module.exports = function(name, opts, manager) { if (typeof this.manager[name] === 'undefined' || typeof this.manager.model[name] !== 'undefined') { this.manager[name] = this } else { - this.warn(`Your model name '${name}' is conflicting, you are only able to + this.warn(`Your model name '${name}' is conflicting with an builtin manager property, you are only able to access this model via \`db.model.${name}\``) }