mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
user log service
This commit is contained in:
18
examples/config.userlog
Normal file
18
examples/config.userlog
Normal file
@@ -0,0 +1,18 @@
|
||||
root = "./"
|
||||
thread = 8
|
||||
logger = "userlog"
|
||||
logservice = "snlua"
|
||||
logpath = "."
|
||||
harbor = 1
|
||||
address = "127.0.0.1:2526"
|
||||
master = "127.0.0.1:2013"
|
||||
start = "main" -- main script
|
||||
bootstrap = "snlua bootstrap" -- The service for bootstrap
|
||||
standalone = "0.0.0.0:2013"
|
||||
luaservice = root.."service/?.lua;"..root.."test/?.lua;"..root.."examples/?.lua"
|
||||
lualoader = "lualib/loader.lua"
|
||||
-- preload = "./examples/preload.lua" -- run preload.lua before every lua service run
|
||||
snax = root.."examples/?.lua;"..root.."test/?.lua"
|
||||
-- snax_interface_g = "snax_g"
|
||||
cpath = root.."cservice/?.so"
|
||||
-- daemon = "./skynet.pid"
|
||||
15
examples/userlog.lua
Normal file
15
examples/userlog.lua
Normal 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)
|
||||
Reference in New Issue
Block a user