Use an explicit prefix

This commit is contained in:
Shane Kilkelly 2017-03-17 11:47:38 +00:00
parent f397678589
commit e7f71a25d8

View file

@ -1,12 +1,12 @@
module.exports = (obj, methodName, key, logger) -> module.exports = (obj, methodName, prefix, logger) ->
metrics = require('./metrics') metrics = require('./metrics')
if typeof obj[methodName] != 'function' if typeof obj[methodName] != 'function'
throw new Error("[Metrics] expected object property '#{methodName}' to be a function") throw new Error("[Metrics] expected object property '#{methodName}' to be a function")
realMethod = obj[methodName] realMethod = obj[methodName]
key = "methods.#{key}" key = "#{prefix}.#{methodName}"
obj[methodName] = (originalArgs...) -> obj[methodName] = (originalArgs...) ->