Skip to content

Commit

Permalink
Fix function names
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 5, 2019
1 parent 3c46886 commit e2b2fdd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/init.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line filenames/match-exported
'use strict'

const process = require('process')
Expand All @@ -10,15 +11,16 @@ const EVENTS = require('./events')
const { emitLimitedWarning } = require('./limit')

// Add event handling for all process-related errors
const init = function(opts) {
const logProcessErrors = function(opts) {
const optsA = getOptions({ opts })

removeWarningListener()

const listeners = addListeners({ opts: optsA })

const stopLoggingA = stopLogging.bind(null, listeners)
return stopLoggingA
// Do not use `function.bind()` to keep the right `function.name`
const stopLogProcessErrors = () => stopLogging(listeners)
return stopLogProcessErrors
}

const addListeners = function({ opts }) {
Expand Down Expand Up @@ -59,4 +61,4 @@ const removeListener = function({ eventListener, eventName }) {
process.removeListener(eventName, eventListener)
}

module.exports = init
module.exports = logProcessErrors

0 comments on commit e2b2fdd

Please sign in to comment.