HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/nowruzgan/rest/node_modules/sails-stringfile/deprecation.js
/**
 * Module dependencies
 */
var _ = require('@sailshq/lodash')
	, logMoreInfoLink = require('./links').logMoreInfoLink
	, util = require('util');


//
// Used for throttling deprecation notices
// 
var featureCache = {};

module.exports = {

	logUpgradeNotice: function(template, values, log) {
		log = log || console.log;
		if (!_.isArray(values)) values = [values];
		log(util.format.apply(null, [template].concat(values)));
	},
	
	logDeprecationNotice: function(feature, moreInfoURL, log) {

		var time = new Date().getTime();
		if (featureCache[feature] && (featureCache[feature] + 5000 > time)) {
			return false;
		} else featureCache[feature] = time;

		log = log || console.log;
		console.log();
		log(util.format('Deprecated:   `%s`', feature).bold);
		if (moreInfoURL) logMoreInfoLink(moreInfoURL, log);
		return true;
	}
};