summaryrefslogtreecommitdiff
path: root/script/pub/report.lua
blob: a695429ece728b2c6dc5bf435bc1c45be82fa25b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)

pub.on('wakeup', function () end)