Skip to content

Commit

Permalink
fix: switch to traditional functions
Browse files Browse the repository at this point in the history
They are marginally faster and this is a very hot path
  • Loading branch information
wraithgar committed Apr 11, 2024
1 parent d32f9ce commit d0a9a06
Showing 1 changed file with 39 additions and 13 deletions.
52 changes: 39 additions & 13 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ module.exports = {
'error',
'buffer',
],
standard: (...args) => process.emit('output', 'standard', ...args),
error: (...args) => process.emit('output', 'error', ...args),
buffer: (...args) => process.emit('output', 'buffer', ...args),
standard: function (...args) {
return process.emit('output', 'standard', ...args)
},
error: function (...args) {
return process.emit('output', 'error', ...args)
},
buffer: function (...args) {
return process.emit('output', 'buffer', ...args)
},
},
log: {
LEVELS: [
Expand All @@ -22,15 +28,35 @@ module.exports = {
'pause',
'resume',
],
error: (...args) => process.emit('log', 'error', ...args),
notice: (...args) => process.emit('log', 'notice', ...args),
warn: (...args) => process.emit('log', 'warn', ...args),
info: (...args) => process.emit('log', 'info', ...args),
verbose: (...args) => process.emit('log', 'verbose', ...args),
http: (...args) => process.emit('log', 'http', ...args),
silly: (...args) => process.emit('log', 'silly', ...args),
timing: (...args) => process.emit('log', 'timing', ...args),
pause: (...args) => process.emit('log', 'pause', ...args),
resume: (...args) => process.emit('log', 'resume', ...args),
error: function (...args) {
return process.emit('log', 'error', ...args)
},
notice: function (...args) {
return process.emit('log', 'notice', ...args)
},
warn: function (...args) {
return process.emit('log', 'warn', ...args)
},
info: function (...args) {
return process.emit('log', 'info', ...args)
},
verbose: function (...args) {
return process.emit('log', 'verbose', ...args)
},
http: function (...args) {
return process.emit('log', 'http', ...args)
},
silly: function (...args) {
return process.emit('log', 'silly', ...args)
},
timing: function (...args) {
return process.emit('log', 'timing', ...args)
},
pause: function (...args) {
return process.emit('log', 'pause', ...args)
},
resume: function (...args) {
return process.emit('log', 'resume', ...args)
},
},
}

0 comments on commit d0a9a06

Please sign in to comment.