mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
log emit notifications
This commit is contained in:
parent
625e0af17c
commit
0fe158737c
@ -116,6 +116,12 @@ function nodeApp(pm2_env, cb){
|
||||
case 'uncaughtException':
|
||||
God.bus.emit('process:exception', {process : clu, msg : msg.stack});
|
||||
break;
|
||||
case 'log:out':
|
||||
God.bus.emit('log:out', {process : clu, data : msg.data});
|
||||
break;
|
||||
case 'log:err':
|
||||
God.bus.emit('log:err', {process : clu, data : msg.data});
|
||||
break;
|
||||
default: // Permits to send message to external from the app
|
||||
God.bus.emit(msg.type ? msg.type : 'msg', msg);
|
||||
}
|
||||
|
||||
@ -80,6 +80,10 @@ function exec(script, outFile, errFile) {
|
||||
process.stderr.write = (function(write) {
|
||||
return function(string, encoding, fd) {
|
||||
stderr.write(string);
|
||||
process.send({
|
||||
type : 'log:out',
|
||||
data : string
|
||||
});
|
||||
};
|
||||
}
|
||||
)(process.stderr.write);
|
||||
@ -87,6 +91,10 @@ function exec(script, outFile, errFile) {
|
||||
process.stdout.write = (function(write) {
|
||||
return function(string, encoding, fd) {
|
||||
stdout.write(string);
|
||||
process.send({
|
||||
type : 'log:err',
|
||||
data : string
|
||||
});
|
||||
};
|
||||
})(process.stdout.write);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user