user log service

This commit is contained in:
Cloud Wu
2015-07-21 11:31:27 +08:00
parent 4cf05fb2e7
commit 3f91484791
2 changed files with 33 additions and 0 deletions

15
examples/userlog.lua Normal file
View File

@@ -0,0 +1,15 @@
local skynet = require "skynet"
require "skynet.manager"
skynet.register_protocol {
name = "text",
id = skynet.PTYPE_TEXT,
unpack = skynet.tostring,
dispatch = function(_, address, msg)
print(string.format("%x(%.2f): %s", address, skynet.time(), msg))
end
}
skynet.start(function()
skynet.register ".logger"
end)