Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace package lifecycle #81

Open
erictheswift opened this issue Mar 25, 2024 · 0 comments
Open

Trace package lifecycle #81

erictheswift opened this issue Mar 25, 2024 · 0 comments

Comments

@erictheswift
Copy link

erictheswift commented Mar 25, 2024

(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')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant