|
|
|
|
@ -1,24 +1,18 @@ |
|
|
|
|
RocketChat.debugLevel = 'debug'; |
|
|
|
|
|
|
|
|
|
Meteor.startup(function() { |
|
|
|
|
RocketChat.settings.onload('Debug_Level', function(key, value/*, initialLoad*/) { |
|
|
|
|
if (value) { |
|
|
|
|
RocketChat.debugLevel = value; |
|
|
|
|
var logger = new Logger('Meteor', { |
|
|
|
|
methods: { |
|
|
|
|
method: { |
|
|
|
|
type: 'debug' |
|
|
|
|
}, |
|
|
|
|
publish: { |
|
|
|
|
type: 'debug' |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var value = RocketChat.settings.get('Debug_Level'); |
|
|
|
|
if (value) { |
|
|
|
|
RocketChat.debugLevel = value; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var wrapMethods = function(name, originalHandler, methodsMap) { |
|
|
|
|
methodsMap[name] = function() { |
|
|
|
|
if (RocketChat.debugLevel === 'debug') { |
|
|
|
|
var args = name === 'ufsWrite' ? Array.prototype.slice.call(arguments, 1) : arguments; |
|
|
|
|
console.log('[methods]'.green, name, '-> userId:', Meteor.userId(), ', arguments: ', args); |
|
|
|
|
} |
|
|
|
|
var args = name === 'ufsWrite' ? Array.prototype.slice.call(arguments, 1) : arguments; |
|
|
|
|
logger.method(name, '-> userId:', Meteor.userId(), ', arguments: ', args); |
|
|
|
|
|
|
|
|
|
return originalHandler.apply(this, arguments); |
|
|
|
|
}; |
|
|
|
|
@ -37,9 +31,7 @@ var originalMeteorPublish = Meteor.publish; |
|
|
|
|
|
|
|
|
|
Meteor.publish = function(name, func) { |
|
|
|
|
return originalMeteorPublish(name, function() { |
|
|
|
|
if (RocketChat.debugLevel === 'debug') { |
|
|
|
|
console.log('[publish]'.green, name, '-> userId:', this.userId, ', arguments: ', arguments); |
|
|
|
|
} |
|
|
|
|
logger.publish(name, '-> userId:', this.userId, ', arguments: ', arguments); |
|
|
|
|
|
|
|
|
|
return func.apply(this, arguments); |
|
|
|
|
}); |
|
|
|
|
|