Skip to content

Commit bc2b0d1

Browse files
committed
simplify and inline apply calls in loggers
1 parent b2c0075 commit bc2b0d1

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/lib/loggers.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ loggers.log = function() {
3030
for(i = 0; i < arguments.length; i++) {
3131
messages.push(arguments[i]);
3232
}
33-
apply(console.trace || console.log, messages);
33+
console.trace.apply(console, messages);
3434
}
3535

3636
if(dfltConfig.notifyOnLogging > 1) {
@@ -50,7 +50,7 @@ loggers.warn = function() {
5050
for(i = 0; i < arguments.length; i++) {
5151
messages.push(arguments[i]);
5252
}
53-
apply(console.trace || console.log, messages);
53+
console.trace.apply(console, messages);
5454
}
5555

5656
if(dfltConfig.notifyOnLogging > 0) {
@@ -70,7 +70,7 @@ loggers.error = function() {
7070
for(i = 0; i < arguments.length; i++) {
7171
messages.push(arguments[i]);
7272
}
73-
apply(console.error, messages);
73+
console.error.apply(console, messages);
7474
}
7575

7676
if(dfltConfig.notifyOnLogging > 0) {
@@ -81,11 +81,3 @@ loggers.error = function() {
8181
notifier(lines.join('<br>'), 'stick');
8282
}
8383
};
84-
85-
function apply(f, args) {
86-
if(f && f.apply) {
87-
// `this` should always be console, since here we're always
88-
// applying a method of the console object.
89-
f.apply(console, args);
90-
}
91-
}

0 commit comments

Comments
 (0)