diff options
Diffstat (limited to 'script/pub/report.lua')
-rw-r--r-- | script/pub/report.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/script/pub/report.lua b/script/pub/report.lua new file mode 100644 index 00000000..549277e1 --- /dev/null +++ b/script/pub/report.lua @@ -0,0 +1,26 @@ +local pub = require 'pub.pub' +local await = require 'await' + +pub.on('log', function (params, brave) + log.raw(brave.id, params.level, params.msg, params.src, params.line, params.clock) +end) + +pub.on('mem', function (count, brave) + brave.memory = count +end) + +pub.on('proto', function (params) + local proto = require 'proto' + await.call(function () + if params.method then + proto.doMethod(params) + else + proto.doResponse(params) + end + end) +end) + +pub.on('protoerror', function (err) + log.warn('Load proto error:', err) + os.exit(true) +end) |