Skip to content

Trace package lifecycle #81

Open
Open
@erictheswift

Description

(Inspired by debugging of #80)

As this wonderful package deals with such sensitive things as life and death of a process and does patching sensitive globals, I think it would be great if its actions could be traced if something goes wrong.

e.g. if you use https://www.npmjs.com/package/debug, then

DEBUG=signal-exit node app.js

could reveal important things in log

tracing variety could be (including but not limited to):

action = debug('signal-exit:action')
lifecycle = debug('signal-exit:lifecycle')

// load:

lifecycle('override process.emit %o with %o', prev, next)
lifecycle('override process.reallyExit %o with %o', prev, next)
lifecycle('process.on(%o)', signals)

// time being:
action('received signal %o', signal)
action('exit prevented by handler %o')
action('process.exitCode = %o', code)
action('process.kill(process.pid, %o)', signal)

// unload:
lifecycle('process.off(%o)', signals)
lifecycle('revert process.reallyExit %o to %o')
lifecycle('revert process.emit %o to %o')

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions