Reputation: 29750
I have a static class in javascript...
var Logger = {
logtofirefox: function (str, priority) {
console.log(str);
},
logtoie: function (str, priority) {
alert(str);
}
}
I call it like this from another file...
Logger.log('Hello World');
But I want to inject the string 'log : ' before the words 'Hello World' on all functions.
Wondering if this is possible with minimum fuss?
Upvotes: 0
Views: 108
Reputation: 38147
Just update the output for each function :
var Logger = {
logtofirefox: function (str, priority) {
console.log('log : ' + str);
},
logtoie: function (str, priority) {
alert('log : ' + str);
}
};
Upvotes: 1