add s.onUserLog event handler

change-spawn-to-worker-for-monitor-daemon
Moe 2021-08-17 20:43:51 -07:00
parent 1c0e9a07bc
commit 9969f33d57
2 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,11 @@ module.exports = function(s,config){
s.onSocketAuthenticationExtensions.push(callback)
}
//
s.onUserLogExtensions = []
s.onUserLog = function(callback){
s.onUserLogExtensions.push(callback)
}
//
s.loadGroupExtensions = []
s.loadGroupExtender = function(callback){
s.loadGroupExtensions.push(callback)

View File

@ -105,7 +105,17 @@ module.exports = function(s,config,lang){
}
})
}
s.tx({f:'log',ke:e.ke,mid:e.mid,log:x,time:s.timeObject()},'GRPLOG_'+e.ke);
const logEvent = {
f: 'log',
ke: e.ke,
mid: e.mid,
log: x,
time: s.timeObject()
}
s.tx(logEvent,'GRPLOG_'+e.ke);
s.onUserLogExtensions.forEach(function(extender){
extender(logEvent)
})
}
s.loadGroup = function(e){
s.loadGroupExtensions.forEach(function(extender){