Skip to content

Commit

Permalink
修改日志输出格式
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaobangyu committed Oct 8, 2023
1 parent 7c92860 commit 6a75d6c
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion script/driver/redis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function RedisDB:check_clusters()
end
local ok, res = self:commit(socket, "cluster", "slots")
if not ok then
log_err("[RedisDB][check_clusters] load cluster slots failed! because: %s", res)
log_err("[RedisDB][check_clusters] load cluster slots failed! because: {}", res)
return
end
for i, info in pairs(res) do
Expand Down
2 changes: 1 addition & 1 deletion script/kernel/protobuf_mgr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function ProtobufMgr:enum(ename, ekey)
local value = emun[ekey]
if not value then
local info = dgetinfo(2, "S")
log_warn("[ProtobufMgr][enum] %s.%s not defined! source({}:{})", ename, ekey, info.short_src, info.linedefined)
log_warn("[ProtobufMgr][enum] {}.{} not defined! source({}:{})", ename, ekey, info.short_src, info.linedefined)
return
end
return value
Expand Down
2 changes: 1 addition & 1 deletion script/network/net_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function NetClient:write(cmd_id, data, type, session_id, flag)
-- call lbus
local send_len = self.socket.call_pb(session_id, cmd_id, flag, type, 0, data)
if send_len < 0 then
log_err("[NetClient][write] call_pb failed! code:%s", send_len)
log_err("[NetClient][write] call_pb failed! code:{}", send_len)
return false
end
--proxy_agent:statistics("on_proto_send", cmd_id, send_len)
Expand Down
2 changes: 1 addition & 1 deletion server/cache/cache_gm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function CacheGM:signed(player_id)
--加载open_id
local code, doc = cache_mgr:load_document("player", player_id)
if qfailed(code) then
log_err("[CacheGM][signed] load_document failed! player_id=%s", player_id)
log_err("[CacheGM][signed] load_document failed! player_id={}", player_id)
return "failed"
end
local open_id = doc:get_datas().open_id
Expand Down
14 changes: 7 additions & 7 deletions server/center/gm_mgr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,25 @@ end

--执行gm, command:string
function GM_Mgr:rpc_execute_command(command)
log_debug("[GM_Mgr][rpc_execute_command] command: %s", command)
log_debug("[GM_Mgr][rpc_execute_command] command: {}", command)
local res = self:exec_command(command)
return SUCCESS, res
end

--执行gm, message: table
function GM_Mgr:rpc_execute_message(message)
log_debug("[GM_Mgr][rpc_execute_message] message: %s", message)
log_debug("[GM_Mgr][rpc_execute_message] message: {}", message)
local res = self:exec_message(message)
return SUCCESS, res
end

function GM_Mgr:on_service_close(id, name)
log_debug("[GM_Mgr][on_service_close] node: %s-%s", name, id)
log_debug("[GM_Mgr][on_service_close] node: {}-{}", name, id)
self.monitors[id] = nil
end

function GM_Mgr:on_service_ready(id, name, info)
log_debug("[GM_Mgr][on_service_ready] node: %s-%s, info: %s", name, id, info)
log_debug("[GM_Mgr][on_service_ready] node: {}-{}, info: {}", name, id, info)
self.monitors[id] = sformat("%s:%s", info.ip, info.port)
end

Expand All @@ -170,7 +170,7 @@ end

--monitor拉取
function GM_Mgr:on_monitors(url, params)
log_debug("[GM_Mgr][on_monitors] body: %s", params)
log_debug("[GM_Mgr][on_monitors] body: {}", params)
local nodes = {}
for _, addr in pairs(self.monitors) do
tinsert(nodes, { text = addr, tag = "log" })
Expand All @@ -180,13 +180,13 @@ end

--后台GM调用,字符串格式
function GM_Mgr:on_command(url, body)
log_debug("[GM_Mgr][on_command] body: %s", body)
log_debug("[GM_Mgr][on_command] body: {}", body)
return self:exec_command(body.data)
end

--后台GM调用,table格式
function GM_Mgr:on_message(url, body)
log_debug("[GM_Mgr][on_message] body: %s", body)
log_debug("[GM_Mgr][on_message] body: {}", body)
return self:exec_message(body.data)
end

Expand Down
2 changes: 1 addition & 1 deletion server/robot/accord_mgr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ end

-- 拉取日志
function AccordMgr:on_message(url, params)
-- log_debug("[AccordMgr][on_message] open_id: %s", params.open_id)
-- log_debug("[AccordMgr][on_message] open_id: {}", params.open_id)
return robot_mgr:get_accord_message(params.open_id)
end

Expand Down
8 changes: 4 additions & 4 deletions server/robot/dao/accord_dao.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end
function AccordDao:load_data(document)
local code, data = mongo_mgr:find(1, mrandom(), document, {})
if code ~= SUCCESS then
log_debug("[AccordDao][load_data] document:%s code:%s", document, code)
log_debug("[AccordDao][load_data] document:{} code:{}", document, code)
return false, code
end
return true, data
Expand All @@ -24,7 +24,7 @@ end
function AccordDao:insert(document, data)
local code, res = mongo_mgr:insert(1, mrandom(), document, data)
if code ~= SUCCESS then
log_debug("[AccordDao][insert] document:%s code:%s", document, code)
log_debug("[AccordDao][insert] document:{} code:{}", document, code)
return false
end
return true
Expand All @@ -35,7 +35,7 @@ function AccordDao:update(document, data)
local udata = { ["$set"] = data }
local code, res = mongo_mgr:update(1, mrandom(), document, udata, { id = data.id })
if code ~= SUCCESS then
log_debug("[AccordDao][update] document:%s code:%s", document, code)
log_debug("[AccordDao][update] document:{} code:{}", document, code)
return false
end
return true
Expand All @@ -45,7 +45,7 @@ end
function AccordDao:delete(document, id)
local code, res = mongo_mgr:delete(1, mrandom(), document, {id=id})
if code ~= SUCCESS then
log_debug("[AccordDao][delete] document:%s code:%s", document, code)
log_debug("[AccordDao][delete] document:{} code:{}", document, code)
return false
end
return true
Expand Down
6 changes: 3 additions & 3 deletions server/robot/module/session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ end

-- 连接成回调
function SessionModule:on_socket_connect(client)
log_debug("[SessionModule][on_socket_connect] %s", self:get_title())
log_debug("[SessionModule][on_socket_connect] {}", self:get_title())
end

-- 连接关闭回调
function SessionModule:on_socket_error(client, token, err)
log_debug("[SessionModule][on_socket_error] %s, err:%s", self:get_title(), err)
log_debug("[SessionModule][on_socket_error] {}, err:{}", self:get_title(), err)
end

--消息回调
Expand All @@ -51,7 +51,7 @@ function SessionModule:on_socket_rpc(client, cmd_id, body)
local doer = self.cmd_doers[cmd_id]
if not doer then
self:push_message(cmd_id, body)
log_warn("[SessionModule][on_socket_rpc] cmd %s hasn't register doer!, msg=%s", cmd_id, body)
log_warn("[SessionModule][on_socket_rpc] cmd {} hasn't register doer!, msg={}", cmd_id, body)
return
end
local module, handler = tunpack(doer)
Expand Down

0 comments on commit 6a75d6c

Please sign in to comment.