diff --git a/server/business/admin/shield.lua b/server/business/admin/shield.lua index be956568..11a85ae6 100644 --- a/server/business/admin/shield.lua +++ b/server/business/admin/shield.lua @@ -37,7 +37,7 @@ function Shield:rpc_add_proto_shield(start_cmd_id, count) for cmd_id = start_cmd_id, end_cmd_id do self.filters[cmd_id] = true end - log_info("[Shield][rpc_add_shield] start_cmd_id=%s count=%s", start_cmd_id, count) + log_info("[Shield][rpc_add_shield] start_cmd_id={} count={}", start_cmd_id, count) end -- 删除协议过滤 @@ -46,12 +46,12 @@ function Shield:rpc_del_proto_shield(start_cmd_id, count) for cmd_id = start_cmd_id, end_cmd_id do self.filters[cmd_id] = nil end - log_info("[Shield][rpc_del_shield] start_cmd_id=%s count=%s", start_cmd_id, count) + log_info("[Shield][rpc_del_shield] start_cmd_id={} count={}", start_cmd_id, count) end -- 清理过滤协议 function Shield:rpc_shield_service_proto(service_type, status) - log_info("[Shield][rpc_shield_service_proto] service_type=%s status=%s", service_type, status) + log_info("[Shield][rpc_shield_service_proto] service_type={} status={}", service_type, status) self.services[service_type] = status end diff --git a/server/business/attr/attribute_agent.lua b/server/business/attr/attribute_agent.lua index 3b4e0892..6e4e987c 100644 --- a/server/business/attr/attribute_agent.lua +++ b/server/business/attr/attribute_agent.lua @@ -33,7 +33,7 @@ function AttributeAgent:on_attr_writeback(player, player_id) local write_attrs = player:get_write_attrs() local ok, code = player:call_lobby("rpc_attr_writeback", write_attrs, quanta.service) if qfailed(code, ok) then - log_err("[AttributeAgent][on_attr_writeback] writeback failed attrs=%s, player=%s, code=%s", write_attrs, player_id, code) + log_err("[AttributeAgent][on_attr_writeback] writeback failed attrs={}, player={}, code={}", write_attrs, player_id, code) end player:set_write_attrs({}) end @@ -44,13 +44,13 @@ end function AttributeAgent:rpc_attr_relay(player_id, attrs, service_id) local player = player_mgr:get_entity(player_id) if not player then - log_err("[AttributeAgent][rpc_attr_relay] player not exist attrs=%s, player_id=%s", attrs, player_id) + log_err("[AttributeAgent][rpc_attr_relay] player not exist attrs={}, player_id={}", attrs, player_id) return ROLE_NOT_EXIST end for attr_id, value in pairs(attrs) do player:set_attr(attr_id, value, service_id) end - log_debug("[AttributeAgent][rpc_attr_relay] success player_id=%s, attrs=%s", player_id, attrs) + log_debug("[AttributeAgent][rpc_attr_relay] success player_id={}, attrs={}", player_id, attrs) return FRAME_SUCCESS end diff --git a/server/business/attr/attribute_relay.lua b/server/business/attr/attribute_relay.lua index 5c1c1b95..46e31d9c 100644 --- a/server/business/attr/attribute_relay.lua +++ b/server/business/attr/attribute_relay.lua @@ -69,13 +69,13 @@ end function AttributeRelay:rpc_attr_writeback(player_id, attrs, service_id) local player = player_mgr:get_entity(player_id) if not player then - log_err("[AttributeRelay][rpc_attr_writeback] player not exist attrs=%s, player_id=%s", attrs, player_id) + log_err("[AttributeRelay][rpc_attr_writeback] player not exist attrs={}, player_id={}", attrs, player_id) return ROLE_NOT_EXIST end for attr_id, value in pairs(attrs) do player:set_attr(attr_id, value, service_id) end - log_debug("[AttributeRelay][rpc_attr_writeback] success! attrs=%s, player_id=%s", attrs, player_id) + log_debug("[AttributeRelay][rpc_attr_writeback] success! attrs={}, player_id={}", attrs, player_id) return FRAME_SUCCESS end @@ -97,7 +97,7 @@ function AttributeRelay:on_attr_relay(player, player_id) if next(attrs) then local ok, code = player:call_service(service_name, "rpc_attr_relay", attrs, quanta.service) if qfailed(code, ok) then - log_err("[AttributeRelay][on_attr_relay] sync failed attrs=%s, player_id=%s, code=%s", attrs, player_id, code) + log_err("[AttributeRelay][on_attr_relay] sync failed attrs={}, player_id={}, code={}", attrs, player_id, code) end end end diff --git a/server/business/component/attr_component.lua b/server/business/component/attr_component.lua index 20b5d96d..9e3dfaa3 100644 --- a/server/business/component/attr_component.lua +++ b/server/business/component/attr_component.lua @@ -61,7 +61,7 @@ end --加载db数据 function AttrComponent:on_db_player_attr_load(data) - log_debug("[AttrComponent][on_db_player_attr_load] data(%s)", data) + log_debug("[AttrComponent][on_db_player_attr_load] data({})", data) if data.player_id then self:load_attrs(data.attrs or {}) return true @@ -75,11 +75,11 @@ end function AttrComponent:set_attr(attr_id, value, service_id) local attr = self.attr_set[attr_id] if not attr then - log_warn("[AttrComponent][set_attr] attr(%s) not define", attr_id) + log_warn("[AttrComponent][set_attr] attr({}) not define", attr_id) return false end if not value then - log_warn("[AttrComponent][set_attr] attr(%s) value is nil", attr_id) + log_warn("[AttrComponent][set_attr] attr({}) value is nil", attr_id) return false end local cur_val = self.attrs[attr_id] @@ -176,7 +176,7 @@ function AttrComponent:load_attrs(attrs) for attr_id, value in pairs(attrs) do local attr = self.attr_set[attr_id] if not attr then - log_warn("[AttrComponent][load_attrs] attr(%s) not define", attr_id) + log_warn("[AttrComponent][load_attrs] attr({}) not define", attr_id) end self:set_attrs_field(attr_id, value) end diff --git a/server/business/component/event_component.lua b/server/business/component/event_component.lua index 9d96930d..d74b2a7a 100644 --- a/server/business/component/event_component.lua +++ b/server/business/component/event_component.lua @@ -18,7 +18,7 @@ function EventComponent:watch_event(watcher, event, handler) local func_name = handler or event local callback_func = watcher[func_name] if not callback_func or type(callback_func) ~= "function" then - log_warn("[EventComponent][watch_event] event(%s) handler not define!", event) + log_warn("[EventComponent][watch_event] event({}) handler not define!", event) return end local watcher_map = self.events[event] @@ -44,7 +44,7 @@ function EventComponent:notify_event(event, ...) local callback_func = watcher[func_name] local ok, ret = xpcall(callback_func, dtraceback, watcher, ...) if not ok then - log_fatal("[EventComponent][notify_event] xpcall [%s:%s] failed: %s!", watcher:source(), func_name, ret) + log_fatal("[EventComponent][notify_event] xpcall [{}:{}] failed: {}!", watcher:source(), func_name, ret) end end end diff --git a/server/business/component/sub_component.lua b/server/business/component/sub_component.lua index 47c8219b..51cfbe30 100644 --- a/server/business/component/sub_component.lua +++ b/server/business/component/sub_component.lua @@ -21,7 +21,7 @@ function SubComponent:register_subhandler(trigger, event, handler) local func_name = handler or event local callback_func = trigger[func_name] if not callback_func or type(callback_func) ~= "function" then - log_warn("[SubComponent][register_subhandler] event(%s) handler is nil!", event) + log_warn("[SubComponent][register_subhandler] event({}) handler is nil!", event) return end self.subhandlers[event] = { trigger, func_name } @@ -67,7 +67,7 @@ function SubComponent:pub_event(serv_name, event, ...) end local hand_info = self.subhandlers[event] if not hand_info then - log_warn("[SubComponent][pub_event] event(%s) subhandlers is nil!", event) + log_warn("[SubComponent][pub_event] event({}) subhandlers is nil!", event) return end local taigger, func_name = tunpack(hand_info) diff --git a/server/business/entity/entity.lua b/server/business/entity/entity.lua index fc8163cd..f1f0204e 100644 --- a/server/business/entity/entity.lua +++ b/server/business/entity/entity.lua @@ -36,12 +36,12 @@ end -- 初始化 function Entity:setup(conf) if not self:load(conf) then - log_warn("[Entity][setup] entity %s load faild!", self.id) + log_warn("[Entity][setup] entity {} load faild!", self.id) return false end local setup_ok = self:collect("_setup") if not setup_ok then - log_warn("[Entity][setup] entity %s setup faild!", self.id) + log_warn("[Entity][setup] entity {} setup faild!", self.id) return setup_ok end return setup_ok diff --git a/server/business/entity/entity_mgr.lua b/server/business/entity/entity_mgr.lua index d6571f10..51312399 100644 --- a/server/business/entity/entity_mgr.lua +++ b/server/business/entity/entity_mgr.lua @@ -37,13 +37,13 @@ end -- 设置实体 function EntityMgr:add_entity(entity_id, entity) - log_info("[EntityMgr][add_entity] entity_id=%s", entity_id) + log_info("[EntityMgr][add_entity] entity_id={}", entity_id) self.entity_map:set(entity_id, entity) end -- 移除实体 function EntityMgr:remove_entity(entity, entity_id) - log_info("[EntityMgr][remove_entity] entity_id=%s", entity_id) + log_info("[EntityMgr][remove_entity] entity_id={}", entity_id) self:on_destory(entity_id, entity) self.entity_map:set(entity_id, nil) entity:destory() diff --git a/server/cache/cache_gm.lua b/server/cache/cache_gm.lua index cccf053a..a5f162be 100644 --- a/server/cache/cache_gm.lua +++ b/server/cache/cache_gm.lua @@ -119,13 +119,13 @@ end --复制缓存数据 function CacheGM:copy_cache(to_player_id, player_id, coll_name) - log_info("[CacheGM][copy_cache] to_player_id=%s, player_id=%s, coll_name=%s", to_player_id, player_id, coll_name) + log_info("[CacheGM][copy_cache] to_player_id={}, player_id={}, coll_name={}", to_player_id, player_id, coll_name) local coll_cfg = cache_db:find_one(coll_name) if not coll_cfg then - return sformat("%s not found cache", coll_name) + return sformat("{} not found cache", coll_name) end if not coll_cfg.copyable then - return sformat("%s cant copy", coll_name) + return sformat("{} cant copy", coll_name) end local ok = cache_mgr:rpc_cache_copy(to_player_id, player_id, coll_name) @@ -137,7 +137,7 @@ end --删除缓存 function CacheGM:del_cache(player_id, coll_name) - log_info("[CacheGM][del_cache] player_id=%s coll_name=%s", player_id, coll_name) + log_info("[CacheGM][del_cache] player_id={} coll_name={}", player_id, coll_name) -- 通知服务 local ok = cache_mgr:rpc_cache_delete(player_id, coll_name) if not ok then @@ -148,29 +148,29 @@ end --更新缓存 function CacheGM:update_cache(player_id, coll_name, field, field_data) - log_info("[CacheGM][update_cache] player_id:%s coll_name=%s field:%s, field_data:%s", player_id, coll_name, field, field_data) + log_info("[CacheGM][update_cache] player_id:{} coll_name={} field:{}, field_data:{}", player_id, coll_name, field, field_data) local pok, datas = pcall(unserialize, field_data) if not pok or not datas then - return sformat("parse failed. field_data:%s", field_data) + return sformat("parse failed. field_data:{}", field_data) end local ok = cache_mgr:rpc_cache_update_field(player_id, coll_name, field, datas) if not ok then - return sformat("failed code:%s", ok) + return sformat("failed code:{}", ok) end return "success" end --查询缓存 function CacheGM:query_cache(player_id, coll_name) - log_info("[CacheGM][query_cache] player_id=%s coll_name=%s", player_id, coll_name) + log_info("[CacheGM][query_cache] player_id={} coll_name={}", player_id, coll_name) -- 通知服务 local ok, doc = cache_mgr:load_document(coll_name, player_id) if not ok or not doc then return "cache not find" end - log_info("[CacheGM][query_cache] player_id=%s coll_name=%s datas:%s", player_id, coll_name, doc:get_datas()) + log_info("[CacheGM][query_cache] player_id={} coll_name={} datas:{}", player_id, coll_name, doc:get_datas()) return doc:get_datas() end diff --git a/server/cache/cache_mgr.lua b/server/cache/cache_mgr.lua index b19c4673..688b9897 100644 --- a/server/cache/cache_mgr.lua +++ b/server/cache/cache_mgr.lua @@ -76,7 +76,7 @@ end --清理缓存 function CacheMgr:on_cache_load(group_name, primary_id) - log_debug("[CacheMgr][on_cache_load] group_name=%s, primary=%s", group_name, primary_id) + log_debug("[CacheMgr][on_cache_load] group_name={}, primary={}", group_name, primary_id) local groups = self.caches[group_name] if groups then groups:del(primary_id) @@ -178,7 +178,7 @@ function CacheMgr:load_group(coll_name, primary_id) local Group = import("cache/group.lua") local group = Group(group_name) if not group:load(primary_id, gconfs) then - log_err("[CacheMgr][load_group] group load failed! coll_name=%s, primary=%s", group_name, primary_id) + log_err("[CacheMgr][load_group] group load failed! coll_name={}, primary={}", group_name, primary_id) return DB_LOAD_ERR end local groups = self.caches[group_name] @@ -204,10 +204,10 @@ end function CacheMgr:rpc_router_update(primary_id, router_id, serv_name, serv_id) local group_name = self.collections[ROUTER_COL] local _ = thread_mgr:lock(sformat("%s.%s", group_name, primary_id), true) - log_debug("[CacheMgr][rpc_router_update] router_id=%s, primary=%s, service: %s-%s", router_id, primary_id, serv_name, serv_id) + log_debug("[CacheMgr][rpc_router_update] router_id={}, primary={}, service: {}-{}", router_id, primary_id, serv_name, serv_id) local ccode, doc = self:load_document(ROUTER_COL, primary_id) if qfailed(ccode) then - log_err("[CacheMgr][rpc_router_update] load_document failed! primary=%s", primary_id) + log_err("[CacheMgr][rpc_router_update] load_document failed! primary={}", primary_id) return ccode end if serv_name and serv_id then @@ -240,10 +240,10 @@ function CacheMgr:rpc_cache_load(primary_id, coll_name) local _ = thread_mgr:lock(sformat("%s.%s", group_name, primary_id), true) local code, doc = self:load_document(coll_name, primary_id) if qfailed(code) then - log_err("[CacheMgr][rpc_cache_load] load_document failed! coll_name=%s, primary=%s", coll_name, primary_id) + log_err("[CacheMgr][rpc_cache_load] load_document failed! coll_name={}, primary={}", coll_name, primary_id) return code end - log_debug("[CacheMgr][rpc_cache_load] coll_name=%s, primary=%s", coll_name, primary_id) + log_debug("[CacheMgr][rpc_cache_load] coll_name={}, primary={}", coll_name, primary_id) return code, doc:get_datas() end @@ -252,10 +252,10 @@ function CacheMgr:rpc_cache_update_field(primary_id, coll_name, field, field_dat local _ = thread_mgr:lock(primary_id, true) local ccode, doc = self:load_document(coll_name, primary_id) if qfailed(ccode) then - log_err("[CacheMgr][rpc_cache_update_field] load_document failed! coll_name=%s, primary=%s, field=%s", coll_name, primary_id, field) + log_err("[CacheMgr][rpc_cache_update_field] load_document failed! coll_name={}, primary={}, field={}", coll_name, primary_id, field) return ccode end - log_debug("[CacheMgr][rpc_cache_update_field] coll_name=%s, primary=%s, field=%s, data:%s", coll_name, primary_id, field, field_data) + log_debug("[CacheMgr][rpc_cache_update_field] coll_name={}, primary={}, field={}, data:{}", coll_name, primary_id, field, field_data) doc:update_field(field, field_data) return SUCCESS end @@ -266,11 +266,11 @@ function CacheMgr:rpc_cache_remove_field(primary_id, coll_name, field) local _ = thread_mgr:lock(sformat("%s.%s", group_name, primary_id), true) local ccode, doc = self:load_document(coll_name, primary_id) if qfailed(ccode) then - log_err("[CacheMgr][rpc_cache_remove_field] load_document failed! coll_name=%s, primary=%s, field=%s", coll_name, primary_id, field) + log_err("[CacheMgr][rpc_cache_remove_field] load_document failed! coll_name={}, primary={}, field={}", coll_name, primary_id, field) return ccode end doc:remove_field(field) - log_debug("[CacheMgr][rpc_cache_remove_field] coll_name=%s, primary=%s, field=%s", coll_name, primary_id, field) + log_debug("[CacheMgr][rpc_cache_remove_field] coll_name={}, primary={}, field={}", coll_name, primary_id, field) return SUCCESS end @@ -280,27 +280,27 @@ function CacheMgr:rpc_cache_delete(primary_id, coll_name) local _ = thread_mgr:lock(sformat("%s.%s", group_name, primary_id), true) local ccode, doc = self:load_document(coll_name, primary_id) if qfailed(ccode) then - log_err("[CacheMgr][rpc_cache_delete] load_document failed! coll_name=%s, primary=%s", coll_name, primary_id) + log_err("[CacheMgr][rpc_cache_delete] load_document failed! coll_name={}, primary={}", coll_name, primary_id) return ccode end local ok, code = doc:destory() if qfailed(code, ok) then self.del_documents[doc] = true - log_err("[CacheMgr][rpc_cache_delete] delete failed! coll_name=%s, primary=%s", coll_name, primary_id) + log_err("[CacheMgr][rpc_cache_delete] delete failed! coll_name={}, primary={}", coll_name, primary_id) return DELETE_FAILD end - log_debug("[CacheMgr][rpc_cache_delete] coll_name=%s, primary=%s", coll_name, primary_id) + log_debug("[CacheMgr][rpc_cache_delete] coll_name={}, primary={}", coll_name, primary_id) return SUCCESS end --复制缓存 function CacheMgr:rpc_cache_copy(to_id, src_id, coll_name) - log_debug("[CacheMgr][rpc_cache_copy] coll_name=%s, src_id=%s, to_id=%s", coll_name, src_id, to_id) + log_debug("[CacheMgr][rpc_cache_copy] coll_name={}, src_id={}, to_id={}", coll_name, src_id, to_id) local group_name = self.collections[coll_name] local _ = thread_mgr:lock(sformat("%s.%s", group_name, to_id), true) local src_code, src_doc, from_mem = self:load_document(coll_name, src_id) if qfailed(src_code) then - log_err("[CacheMgr][rpc_cache_copy] load_document failed! coll_name=%s, src_id=%s", coll_name, src_id) + log_err("[CacheMgr][rpc_cache_copy] load_document failed! coll_name={}, src_id={}", coll_name, src_id) return src_code end --原表是否为空 @@ -312,7 +312,7 @@ function CacheMgr:rpc_cache_copy(to_id, src_id, coll_name) end local to_code, doc = self:load_document(coll_name, to_id) if qfailed(to_code) then - log_err("[CacheMgr][rpc_cache_copy] load_document failed! coll_name=%s, to_id=%s", coll_name, to_id) + log_err("[CacheMgr][rpc_cache_copy] load_document failed! coll_name={}, to_id={}", coll_name, to_id) if not from_mem then self:clear_document(coll_name, src_id) end @@ -333,10 +333,10 @@ function CacheMgr:rpc_cache_signed(primary_id, coll_name) local _ = thread_mgr:lock(sformat("%s.%s", group_name, primary_id), true) local ccode, doc = self:load_document(coll_name, primary_id) if qfailed(ccode) then - log_err("[CacheMgr][rpc_cache_signed] load_document failed! coll_name=%s, primary=%s, field=%s", coll_name, primary_id, field) + log_err("[CacheMgr][rpc_cache_signed] load_document failed! coll_name={}, primary={}, field={}", coll_name, primary_id, field) return ccode end - log_debug("[CacheMgr][rpc_cache_signed] coll_name=%s, primary=%s, field=%s, data:%s", coll_name, primary_id, field, field_data) + log_debug("[CacheMgr][rpc_cache_signed] coll_name={}, primary={}, field={}, data:{}", coll_name, primary_id, field, field_data) doc:update_field(field, field_data) --强制落库 doc:update() diff --git a/server/cache/document.lua b/server/cache/document.lua index 44ef48ca..a73c2b53 100644 --- a/server/cache/document.lua +++ b/server/cache/document.lua @@ -56,7 +56,7 @@ function Document:load() local query = { [self.primary_key] = pid } local code, res = mongo_mgr:find_one(MAIN_DBID, pid, self.coll_name, query, { _id = 0 }) if qfailed(code) then - log_err("[Document][load] failed: %s=> table: %s", res, self.coll_name) + log_err("[Document][load] failed: {}=> table: {}", res, self.coll_name) return code end self.datas = res or {} @@ -67,7 +67,7 @@ end function Document:merge() local code, res = redis_mgr:execute(MAIN_DBID, "HGETALL", self.hotkey) if qfailed(code) then - log_err("[Document][merge] failed: %s=> table: %s", res, self.coll_name) + log_err("[Document][merge] failed: {}=> table: {}", res, self.coll_name) return code end if next(res) then @@ -94,12 +94,12 @@ function Document:destory() local query = { [self.primary_key] = self.primary_id } local code, res = mongo_mgr:delete(MAIN_DBID, self.primary_id, self.coll_name, query, true) if qfailed(code) then - log_err("[Document][destory] del failed: %s=> table: %s", res, self.coll_name) + log_err("[Document][destory] del failed: {}=> table: {}", res, self.coll_name) return false, code end local rcode, rres = redis_mgr:execute(MAIN_DBID, "DEL", self.hotkey) if qfailed(rcode) then - log_err("[Document][destory] del failed: %s=> hotkey: %s", rres, self.hotkey) + log_err("[Document][destory] del failed: {}=> hotkey: {}", rres, self.hotkey) return false, code end return true, SUCCESS @@ -120,7 +120,7 @@ function Document:update() channel:push(function() local rcode, rres = redis_mgr:execute(MAIN_DBID, "DEL", self.hotkey) if qfailed(rcode) then - log_err("[Document][update] del failed: %s=> hotkey: %s", rres, self.hotkey) + log_err("[Document][update] del failed: {}=> hotkey: {}", rres, self.hotkey) return false, rcode end self.flushing = false @@ -130,7 +130,7 @@ function Document:update() local selector = { [self.primary_key] = self.primary_id } local code, res = mongo_mgr:update(MAIN_DBID, self.primary_id, self.coll_name, self.datas, selector, true) if qfailed(code) then - log_err("[Document][update] update failed: %s=> table: %s", res, self.coll_name) + log_err("[Document][update] update failed: {}=> table: {}", res, self.coll_name) return false, code end return true, SUCCESS @@ -240,7 +240,7 @@ end function Document:cmomit_redis(field, value) local code, res = redis_mgr:execute(MAIN_DBID, "HSET", self.hotkey, field, { val = value }) if qfailed(code) then - log_err("[Document][cmomit_redis] failed: %s=> hotkey: %s", res, self.hotkey) + log_err("[Document][cmomit_redis] failed: {}=> hotkey: {}", res, self.hotkey) self:flush() return end diff --git a/server/cache/group.lua b/server/cache/group.lua index 06f30757..1caf0674 100644 --- a/server/cache/group.lua +++ b/server/cache/group.lua @@ -27,7 +27,7 @@ function Group:load(primary_id, gconfs) local doc = Document(conf, primary_id) local code = doc:load() if qfailed(code) then - log_err("[Group][load] load doc failed: tab_name=%s", sheet) + log_err("[Group][load] load doc failed: tab_name={}", sheet) return false, code end self.documents[sheet] = doc diff --git a/server/center/center_gm.lua b/server/center/center_gm.lua index abe00767..4e7b0876 100644 --- a/server/center/center_gm.lua +++ b/server/center/center_gm.lua @@ -74,21 +74,21 @@ end -- 添加协议屏蔽(多个) function CenterGM:add_proto_shield(start_cmd_id, count) - log_info("[CenterGM][add_proto_shield] start_cmd_id=%s count=%s", start_cmd_id, count) + log_info("[CenterGM][add_proto_shield] start_cmd_id={} count={}", start_cmd_id, count) -- 通知服务 self:call_command_service(start_cmd_id, "rpc_add_proto_shield", start_cmd_id, count) end -- 删除协议屏蔽(多个) function CenterGM:del_proto_shield(start_cmd_id, count) - log_info("[CenterGM][del_proto_shield] start_cmd_id=%s count=%s", start_cmd_id, count) + log_info("[CenterGM][del_proto_shield] start_cmd_id={} count={}", start_cmd_id, count) -- 通知服务 self:call_command_service(start_cmd_id, "rpc_del_proto_shield", start_cmd_id, count) end -- 屏蔽服务协议 function CenterGM:shield_service_proto(service_type, status) - log_info("[CenterGM][shield_service_proto] service_type: %s, status:%s", service_type, status) + log_info("[CenterGM][shield_service_proto] service_type: {}, status:{}", service_type, status) -- 通知服务 if service_type ~= 0 then router_mgr:call_gateway_all("rpc_shield_service_proto", service_type, status) @@ -100,7 +100,7 @@ end -- 设置日志等级 function CenterGM:set_logger_level(service_id, level) - log_info("[CenterGM][set_logger_level] service_id: %s, level:%s", service_id, level) + log_info("[CenterGM][set_logger_level] service_id: {}, level:{}", service_id, level) -- 通知服务 router_mgr:broadcast(service_id, "rpc_set_logger_level", level) end diff --git a/server/center/gm_mgr.lua b/server/center/gm_mgr.lua index 6fb85734..615af598 100644 --- a/server/center/gm_mgr.lua +++ b/server/center/gm_mgr.lua @@ -240,7 +240,7 @@ end function GM_Mgr:exec_global_cmd(service_id, cmd_name, ...) local ok, codeoe, res = router_mgr:call_master(service_id, "rpc_command_execute" , cmd_name, ...) if not ok then - log_err("[GM_Mgr][exec_global_cmd] rpc_command_execute failed! service_id:%s, cmd_name=%s", service_id, cmd_name) + log_err("[GM_Mgr][exec_global_cmd] rpc_command_execute failed! service_id:{}, cmd_name={}", service_id, cmd_name) return { code = 1, msg = codeoe } end return { code = codeoe, msg = res } @@ -252,7 +252,7 @@ function GM_Mgr:exec_system_cmd(service_id, cmd_name, target_id, ...) local quanta_id = make_sid(service_id, index) local ok, codeoe, res = router_mgr:call_target(quanta_id, "rpc_command_execute" , cmd_name, target_id, ...) if not ok then - log_err("[GM_Mgr][exec_system_cmd] rpc_command_execute failed! cmd_name=%s", cmd_name) + log_err("[GM_Mgr][exec_system_cmd] rpc_command_execute failed! cmd_name={}", cmd_name) return { code = 1, msg = codeoe } end return { code = codeoe, msg = res } @@ -262,7 +262,7 @@ end function GM_Mgr:exec_service_cmd(service_id, cmd_name, ...) local ok, codeoe = router_mgr:broadcast(service_id, "rpc_command_execute" , cmd_name, ...) if not ok then - log_err("[GM_Mgr][exec_service_cmd] rpc_command_execute failed! cmd_name=%s", cmd_name) + log_err("[GM_Mgr][exec_service_cmd] rpc_command_execute failed! cmd_name={}", cmd_name) return { code = 1, msg = codeoe } end return { code = codeoe, msg = "success" } @@ -272,7 +272,7 @@ end function GM_Mgr:exec_hash_cmd(service_id, cmd_name, target_id, ...) local ok, codeoe, res = router_mgr:call_hash(service_id, target_id, "rpc_command_execute", cmd_name, target_id, ...) if not ok then - log_err("[GM_Mgr][exec_hash_cmd] rpc_command_execute failed! cmd_name=%s", cmd_name) + log_err("[GM_Mgr][exec_hash_cmd] rpc_command_execute failed! cmd_name={}", cmd_name) return { code = 1, msg = codeoe } end return { code = codeoe, msg = res } @@ -286,16 +286,16 @@ end --兼容在线和离线的玩家指令 function GM_Mgr:exec_offline_cmd(service_id, cmd_name, player_id, ...) - log_debug("[GM_Mgr][exec_offline_cmd] cmd_name:%s player_id:%s", cmd_name, player_id) + log_debug("[GM_Mgr][exec_offline_cmd] cmd_name:{} player_id:{}", cmd_name, player_id) local ok, codeoe, res = online:call_lobby(player_id, "rpc_command_execute", cmd_name, player_id, ...) if not ok then - log_err("[GM_Mgr][exec_offline_cmd] rpc_command_execute failed! cmd_name=%s player_id=%s", cmd_name, player_id) + log_err("[GM_Mgr][exec_offline_cmd] rpc_command_execute failed! cmd_name={} player_id={}", cmd_name, player_id) return { code = 1, msg = codeoe } end if codeoe == PLAYER_NOT_EXIST then ok, codeoe, res = router_mgr:call_lobby_hash(player_id, "rpc_command_execute", cmd_name, player_id, ...) if not ok then - log_err("[GM_Mgr][exec_offline_cmd] rpc_command_execute failed! player_id:%s, cmd_name=%s", player_id, cmd_name) + log_err("[GM_Mgr][exec_offline_cmd] rpc_command_execute failed! player_id:{}, cmd_name={}", player_id, cmd_name) return { code = 1, msg = codeoe } end return { code = codeoe, msg = res } @@ -308,14 +308,14 @@ function GM_Mgr:exec_player_cmd(service_id, cmd_name, player_id, ...) if player_id == 0 then local ok, codeoe, res = router_mgr:call_lobby_random("rpc_command_execute", cmd_name, player_id, ...) if not ok then - log_err("[GM_Mgr][exec_player_cmd] rpc_command_execute failed! cmd_name=%s player_id=%s", cmd_name, player_id) + log_err("[GM_Mgr][exec_player_cmd] rpc_command_execute failed! cmd_name={} player_id={}", cmd_name, player_id) return { code = 1, msg = codeoe } end return { code = codeoe, msg = res } end local ok, codeoe, res = online:call_lobby(player_id, "rpc_command_execute", cmd_name, player_id, ...) if not ok then - log_err("[GM_Mgr][exec_player_cmd] rpc_command_execute failed! cmd_name=%s player_id=%s", cmd_name, player_id) + log_err("[GM_Mgr][exec_player_cmd] rpc_command_execute failed! cmd_name={} player_id={}", cmd_name, player_id) return { code = 1, msg = codeoe } end return { code = codeoe, msg = res } diff --git a/server/gateway/gateway.lua b/server/gateway/gateway.lua index 4e70bb32..2ffbe43d 100644 --- a/server/gateway/gateway.lua +++ b/server/gateway/gateway.lua @@ -74,7 +74,7 @@ end --lobby关闭 ---------------------------------------------------------------- function Gateway:on_service_close(id, name, info) - log_debug("[Gateway][on_service_close] node: %s-%s", name, id) + log_debug("[Gateway][on_service_close] node: {}-{}", name, id) for player_id, player in pairs(self.players) do if player:get_lobby_id() == id then self:kickout_client(player, player_id, SERVER_UPHOLD) @@ -115,12 +115,12 @@ end --更新分组信息 function Gateway:rpc_update_group(player_id, group_name, group_id) - log_debug("[Gateway][rpc_update_group] player(%s) group_name(%s) group_id(%s)", player_id, group_name, group_id) + log_debug("[Gateway][rpc_update_group] player({}) group_name({}) group_id({})", player_id, group_name, group_id) local player = self:get_player(player_id) if player then player:update_group(group_name, group_id) else - log_warn("[Gateway][rpc_update_group] not player player(%s) group_name(%s) group_id(%s)", player_id, group_name, group_id) + log_warn("[Gateway][rpc_update_group] not player player({}) group_name({}) group_id({})", player_id, group_name, group_id) end end @@ -167,7 +167,7 @@ function Gateway:rpc_forward_client(player_id, cmd_id, data) self.ntf_counter:count_increase() local player = self:get_player(player_id) if not player then - log_warn("[Gateway][rpc_forward_client] cmd_id(%s) player(%s) not exist!", cmd_id, player_id) + log_warn("[Gateway][rpc_forward_client] cmd_id({}) player({}) not exist!", cmd_id, player_id) return end player:send_message(cmd_id, data, self:is_print_cmd(cmd_id)) @@ -234,13 +234,13 @@ end --玩家登陆 function Gateway:on_role_login_req(session, cmd_id, body, session_id) local open_id, player_id, lobby, token = body.open_id, body.role_id, body.lobby, body.token - log_debug("[Gateway][on_role_login_req] user(%s) player(%s) login start!", open_id, player_id) + log_debug("[Gateway][on_role_login_req] user({}) player({}) login start!", open_id, player_id) local player = self:get_player(player_id) if player then local osession = player:get_session() if osession == session then --重复发送 - log_err("[Gateway][on_role_login_req] player (%s) call repeated login req", player_id) + log_err("[Gateway][on_role_login_req] player ({}) call repeated login req", player_id) return client_mgr:callback_errcode(session, cmd_id, ROLE_IS_INLINE, session_id) end --踢掉老连接,设置新连接 @@ -252,12 +252,12 @@ function Gateway:on_role_login_req(session, cmd_id, body, session_id) online:login_service(player_id, "gateway", quanta.id) local code, new_token = self:call_lobby(lobby, "rpc_player_login", player_id, open_id, token) if qfailed(code) then - log_err("[Gateway][on_role_login_req] player (%s) call rpc_player_login code %s failed: %s", player_id, code, new_token) + log_err("[Gateway][on_role_login_req] player ({}) call rpc_player_login code {} failed: {}", player_id, code, new_token) return client_mgr:callback_errcode(session, cmd_id, code, session_id) end session.player_id = player_id self:add_player(player, player_id, lobby, new_token) - log_info("[Gateway][on_role_login_req] user:%s player:%s, new_token:%s login success!", open_id, player_id, new_token) + log_info("[Gateway][on_role_login_req] user:{} player:{}, new_token:{} login success!", open_id, player_id, new_token) local callback_data = { error_code = code, token = new_token} client_mgr:callback_by_id(session, cmd_id, callback_data, session_id) end @@ -265,16 +265,16 @@ end --玩家登出 function Gateway:on_role_logout_req(session, cmd_id, body, session_id) local player_id = body.role_id - log_debug("[Gateway][on_role_logout_req] player(%s) logout start!", player_id) + log_debug("[Gateway][on_role_logout_req] player({}) logout start!", player_id) local player = self:get_player(player_id) if player then local code, err = self:call_lobby(player:get_lobby_id(), "rpc_player_logout", player_id) if qfailed(code) then - log_err("[Gateway][on_role_logout_req] call rpc_player_logout code %s failed: %s", code, err) + log_err("[Gateway][on_role_logout_req] call rpc_player_logout code {} failed: {}", code, err) return client_mgr:callback_errcode(session, cmd_id, code, session_id) end online:login_service(player_id, "gateway", 0) - log_info("[Gateway][on_role_logout_req] player(%s) logout success!", player_id) + log_info("[Gateway][on_role_logout_req] player({}) logout success!", player_id) client_mgr:callback_errcode(session, cmd_id, code, session_id) self:close_client(player, player_id) end @@ -283,13 +283,13 @@ end --玩家重登 function Gateway:on_role_reload_req(session, cmd_id, body, session_id) local open_id, player_id, lobby, token = body.open_id, body.role_id, body.lobby, body.token - log_debug("[Gateway][on_role_reload_req] user:%s player:%s token:%s reload start!", open_id, player_id, token) + log_debug("[Gateway][on_role_reload_req] user:{} player:{} token:{} reload start!", open_id, player_id, token) local player = self:get_player(player_id) if player then local osession = player:get_session() if osession == session then --重复发送 - log_err("[Gateway][on_role_reload_req] player (%s) call repeated reload req", player_id) + log_err("[Gateway][on_role_reload_req] player ({}) call repeated reload req", player_id) return client_mgr:callback_errcode(session, cmd_id, ROLE_IS_INLINE, session_id) end --踢掉老连接,设置新连接 @@ -303,7 +303,7 @@ function Gateway:on_role_reload_req(session, cmd_id, body, session_id) end local code, new_token = self:call_lobby(lobby, "rpc_player_reload", player_id, token) if qfailed(code) then - log_err("[Gateway][on_role_reload_req] call rpc_player_reload code %s failed: %s", code, new_token) + log_err("[Gateway][on_role_reload_req] call rpc_player_reload code {} failed: {}", code, new_token) return client_mgr:callback_by_id(session, cmd_id, { error_code = 0, token = 0 }, session_id) end if new_token > 0 then @@ -311,7 +311,7 @@ function Gateway:on_role_reload_req(session, cmd_id, body, session_id) self:add_player(player, player_id, lobby, new_token) end online:login_service(player_id, "gateway", quanta.id) - log_info("[Gateway][on_role_reload_req] user:%s player:%s new_token:%s reload success!", open_id, player_id, new_token) + log_info("[Gateway][on_role_reload_req] user:{} player:{} new_token:{} reload success!", open_id, player_id, new_token) local callback_data = { error_code = code, token = new_token} client_mgr:callback_by_id(session, cmd_id, callback_data, session_id) end @@ -320,7 +320,7 @@ end ---------------------------------------------------------------------- --客户端连上 function Gateway:on_socket_accept(session) - --log_debug("[Gateway][on_socket_accept] %s connected!", session.token) + --log_debug("[Gateway][on_socket_accept] {} connected!", session.token) end --客户端连接断开 @@ -328,7 +328,7 @@ function Gateway:on_socket_error(session, token, err) local player_id = session.player_id local player = self:get_player(player_id) if player then - log_warn("[Gateway][on_socket_error] session(%s-%s) lost, because: %s!", token, player_id, err) + log_warn("[Gateway][on_socket_error] session({}-{}) lost, because: {}!", token, player_id, err) self:remove_player(player, player_id) online:login_service(player_id, "gateway", 0) player:notify_disconnect() @@ -341,7 +341,7 @@ function Gateway:on_socket_cmd(session, service_type, cmd_id, body, session_id) self.req_counter:count_increase() local result = event_mgr:notify_listener("on_proto_filter", cmd_id, service_type) if result[1] and result[2] then - log_warn("[Gateway][on_socket_cmd] on_proto_filter false, cmd_id=%s", cmd_id) + log_warn("[Gateway][on_socket_cmd] on_proto_filter false, cmd_id={}", cmd_id) client_mgr:callback_errcode(session, cmd_id, FRAME_UPHOLD, session_id) return end @@ -354,7 +354,7 @@ function Gateway:on_socket_cmd(session, service_type, cmd_id, body, session_id) local player_id = session.player_id local player = self:get_player(player_id) if not player then - log_warn("[Gateway][on_socket_cmd] need login, cmd_id=%s, player_id=%s", cmd_id, player_id) + log_warn("[Gateway][on_socket_cmd] need login, cmd_id={}, player_id={}", cmd_id, player_id) client_mgr:callback_errcode(session, cmd_id, FRAME_FAILED, session_id) return end diff --git a/server/gateway/group_mgr.lua b/server/gateway/group_mgr.lua index 68496853..a0871f0c 100644 --- a/server/gateway/group_mgr.lua +++ b/server/gateway/group_mgr.lua @@ -14,7 +14,7 @@ end --更新服务网关 function GroupMgr:add_member(group_id, player_id, player) - log_info("[GroupMgr][add_member] group_id(%s) player_id(%s)!", group_id, player_id) + log_info("[GroupMgr][add_member] group_id({}) player_id({})!", group_id, player_id) local group = self.groups[group_id] local token = player:get_session_token() if not group then @@ -26,7 +26,7 @@ end --更新分组信息 function GroupMgr:remove_member(group_id, player_id) - log_info("[GroupMgr][remove_member] group_id(%s) player_id(%s)!", group_id, player_id) + log_info("[GroupMgr][remove_member] group_id({}) player_id({})!", group_id, player_id) local group = self.groups[group_id] if group then group[player_id] = nil diff --git a/server/gateway/player.lua b/server/gateway/player.lua index e1517af6..2e8694c3 100644 --- a/server/gateway/player.lua +++ b/server/gateway/player.lua @@ -35,7 +35,7 @@ end --更新分组信息 function GatePlayer:update_group(group_name, group_id) - log_info("[GatePlayer][update_group] player(%d) group(%s) id(%s)!", self.player_id, group_name, group_id) + log_info("[GatePlayer][update_group] player({}) group({}) id({})!", self.player_id, group_name, group_id) local old_group = self.groups[group_name] self.groups[group_name] = group_id --管理 玩家 group 信息 @@ -64,7 +64,7 @@ end function GatePlayer:send_message(cmd_id, data, display) client_mgr:send(self.session, cmd_id, data) if display then - log_debug("[GatePlayer][send_message] player(%s) send message(%s-%s) !", self.player_id, cmd_id, data) + log_debug("[GatePlayer][send_message] player({}) send message({}-{}) !", self.player_id, cmd_id, data) end end @@ -73,12 +73,12 @@ function GatePlayer:notify_command(service_id, cmd_id, body, session_id, display local pla_id = self.player_id local ok, codeoe, res = router_mgr:forward_call(pla_id, service_id, "rpc_player_command", pla_id, cmd_id, body) if qfailed(codeoe, ok) then - log_err("[GatePlayer][notify_command] player(%s) rpc_player_command(%s) code %s, failed: %s", pla_id, cmd_id, codeoe, res) + log_err("[GatePlayer][notify_command] player({}) rpc_player_command({}) code {}, failed: {}", pla_id, cmd_id, codeoe, res) client_mgr:callback_errcode(self.session, cmd_id, codeoe, session_id) return end if display then - log_debug("[GatePlayer][notify_command] player(%s) response message(%s-%s) !", pla_id, cmd_id, res) + log_debug("[GatePlayer][notify_command] player({}) response message({}-{}) !", pla_id, cmd_id, res) end client_mgr:callback_by_id(self.session, cmd_id, res, session_id) end diff --git a/server/lobby/player/player.lua b/server/lobby/player/player.lua index 0d385fa6..d4a635bf 100644 --- a/server/lobby/player/player.lua +++ b/server/lobby/player/player.lua @@ -85,7 +85,7 @@ function Player:load(conf) self:invoke("_load", channel, self.id) local ok, code = channel:execute() if not ok then - log_warn("[Player][load] player(%s) failed: %s!", self.id, code) + log_warn("[Player][load] player({}) failed: {}!", self.id, code) end return ok end @@ -127,7 +127,7 @@ function Player:check(now) if self.status == ONL_LOADING then --加载失败 if now_ms - self.active_time > SECOND_5_MS then - log_warn("[Player][check] player(%s) load too long, will be destory!", self.id) + log_warn("[Player][check] player({}) load too long, will be destory!", self.id) self:set_release(true) self.status = ONL_CLOSE end @@ -136,7 +136,7 @@ function Player:check(now) if self.status == ONL_OFFLINE then --掉线清理 if now_ms - self.active_time > OFFTIMEOUT then - log_warn("[Player][check] player(%s) offline too long, will be destory!", self.id) + log_warn("[Player][check] player({}) offline too long, will be destory!", self.id) self:set_release(true) self.status = ONL_CLOSE end @@ -161,7 +161,7 @@ function Player:online() --load success self:save_login_time(quanta.now) self.load_success = true - log_info("[Player][online] player(%s) is online!", self.id) + log_info("[Player][online] player({}) is online!", self.id) end --掉线 @@ -170,7 +170,7 @@ function Player:offline() self.active_time = quanta.now_ms --invoke self:invoke("_offline") - log_warn("[Player][offline] player(%s) is offline!", self.id) + log_warn("[Player][offline] player({}) is offline!", self.id) end function Player:relive() @@ -179,7 +179,7 @@ function Player:relive() self.active_time = quanta.now_ms --invoke self:invoke("_relive") - log_warn("[Player][relive] player(%s) is relive!", self.id) + log_warn("[Player][relive] player({}) is relive!", self.id) end --unload diff --git a/server/lobby/player/player_mgr.lua b/server/lobby/player/player_mgr.lua index ddf79155..840dc715 100644 --- a/server/lobby/player/player_mgr.lua +++ b/server/lobby/player/player_mgr.lua @@ -87,7 +87,7 @@ end function PlayerMgr:load_account(open_id, player_id) local account = Account(open_id) if not account:load() then - log_err("[PlayerMgr][load_account] (%s-%s)load account failed", open_id, player_id) + log_err("[PlayerMgr][load_account] ({}-{})load account failed", open_id, player_id) return end return account @@ -102,7 +102,7 @@ end --群发信息 function PlayerMgr:group_message(players, cmd_id, data) - log_debug("[PlayerMgr][group_message] players: %s, cmdid: %s", players, cmd_id) + log_debug("[PlayerMgr][group_message] players: {}, cmdid: {}", players, cmd_id) for _, player_id in pairs(players) do local player = self:get_entity(player_id) if player then diff --git a/server/lobby/servlet/lobby_servlet.lua b/server/lobby/servlet/lobby_servlet.lua index 60669946..88126984 100644 --- a/server/lobby/servlet/lobby_servlet.lua +++ b/server/lobby/servlet/lobby_servlet.lua @@ -85,7 +85,7 @@ end function LobbyServlet:rpc_player_command(player_id, cmd_id, message) local player = player_mgr:get_entity(player_id) if not player then - log_err("[LobbyServlet][rpc_player_command] need login cmd_id=%s, player_id=%s", cmd_id, player_id) + log_err("[LobbyServlet][rpc_player_command] need login cmd_id={}, player_id={}", cmd_id, player_id) return ROLE_NOT_EXIST end local result = event_mgr:notify_command(cmd_id, player, player_id, message) @@ -96,7 +96,7 @@ function LobbyServlet:rpc_player_command(player_id, cmd_id, message) end function LobbyServlet:rpc_player_login(player_id, open_id, token) - log_debug("[LobbyServlet][rpc_player_login] open_id(%s) player(%s) token(%s) login req!", open_id, player_id, token) + log_debug("[LobbyServlet][rpc_player_login] open_id({}) player({}) token({}) login req!", open_id, player_id, token) local account = player_mgr:load_account(open_id, player_id) if not account then return ROLE_TOKEN_ERR @@ -104,12 +104,12 @@ function LobbyServlet:rpc_player_login(player_id, open_id, token) --验证token local ok, login_token = self:check_login_token(open_id, token) if not ok then - log_err("[LobbyServlet][rpc_player_login] token verify failed! player:%s, token: %s-%s", player_id, token, login_token) + log_err("[LobbyServlet][rpc_player_login] token verify failed! player:{}, token: {}-{}", player_id, token, login_token) return ROLE_TOKEN_ERR end local player = player_mgr:load_player(account, player_id) if not player then - log_err("[LobbyServlet][rpc_player_login] load_player failed! player:%s", player_id) + log_err("[LobbyServlet][rpc_player_login] load_player failed! player:{}", player_id) return FRAME_FAILED end --通知登陆成功 @@ -122,23 +122,23 @@ function LobbyServlet:rpc_player_login(player_id, open_id, token) --通知登陆成功 event_mgr:notify_trigger("on_login_success", player_id, player) end) - log_info("[LobbyServlet][rpc_player_login] player(%s) login success!", player_id) + log_info("[LobbyServlet][rpc_player_login] player({}) login success!", player_id) return FRAME_SUCCESS, new_token end function LobbyServlet:rpc_player_logout(player_id) - log_debug("[LobbyServlet][rpc_player_logout] player(%s) logout req!", player_id) + log_debug("[LobbyServlet][rpc_player_logout] player({}) logout req!", player_id) local player = player_mgr:get_entity(player_id) if not player then return ROLE_NOT_EXIST end player_mgr:remove_entity(player, player_id) - log_info("[LobbyServlet][rpc_player_logout] player(%s) logout success!", player_id) + log_info("[LobbyServlet][rpc_player_logout] player({}) logout success!", player_id) return FRAME_SUCCESS end function LobbyServlet:rpc_player_reload(player_id, token) - log_debug("[LobbyServlet][rpc_player_reload] player(%s) reload req!", player_id) + log_debug("[LobbyServlet][rpc_player_reload] player({}) reload req!", player_id) local player = player_mgr:get_entity(player_id) if not player then return ROLE_NOT_EXIST @@ -150,14 +150,14 @@ function LobbyServlet:rpc_player_reload(player_id, token) --验证token local old_token = account:get_reload_token() if token ~= old_token then - log_err("[LobbyServlet][rpc_player_login] token verify failed! player:%s, token: %s-%s", player_id, token, old_token) + log_err("[LobbyServlet][rpc_player_login] token verify failed! player:{}, token: {}-{}", player_id, token, old_token) return ROLE_TOKEN_ERR end player:relive() local new_token = mrandom() account:set_reload_token(new_token) event_mgr:notify_trigger("on_reload_success", player_id, player) - log_debug("[LobbyServlet][rpc_player_reload] player(%s) reload success!", player_id) + log_debug("[LobbyServlet][rpc_player_reload] player({}) reload success!", player_id) return FRAME_SUCCESS, new_token end diff --git a/server/login/login_dao.lua b/server/login/login_dao.lua index e5f0227b..3bc71789 100644 --- a/server/login/login_dao.lua +++ b/server/login/login_dao.lua @@ -26,7 +26,7 @@ end function LoginDao:get_autoinc_id(user_id) local aok, acode, role_id = redis_agent:execute({ "INCR", AUTOINCKEY }) if qfailed(acode, aok) then - log_err("[LoginDao][get_autoinc_id] user_id: %s get_autoinc_id failed! code: %s, res: %s", user_id, acode, role_id) + log_err("[LoginDao][get_autoinc_id] user_id: {} get_autoinc_id failed! code: {}, res: {}", user_id, acode, role_id) return false end return true, SUCCESS, BENCHMARK + role_id @@ -35,7 +35,7 @@ end function LoginDao:check_name_exist(name) local ok, code, udata = mongo_agent:find_one({ "player", { nick = name }, { nick = 1 } }) if qfailed(code, ok) then - log_err("[LoginDao][check_name_exist] name: %s find failed! code: %s, res: %s", name, code, udata) + log_err("[LoginDao][check_name_exist] name: {} find failed! code: {}, res: {}", name, code, udata) return false end return (udata ~= nil) @@ -53,7 +53,7 @@ function LoginDao:create_player(open_id, player_id, data) } local ok, code, udata = mongo_agent:insert({ "player", pdata }) if qfailed(code, ok) then - log_err("[LoginDao][create_player] player_id: %s create failed! code: %s, res: %s", player_id, code, udata) + log_err("[LoginDao][create_player] player_id: {} create failed! code: {}, res: {}", player_id, code, udata) return false end return true @@ -66,7 +66,7 @@ function LoginDao:check_player(user_id, name) local check_res = event_mgr:notify_listener("on_safe_text", user_id, name) local check_ok, code, result_name = tunpack(check_res) if qfailed(code, check_ok) then - log_err("[LoginDao][check_player] user_id:%s ok:%s code:%s result_name:%s", user_id, check_ok, code, result_name) + log_err("[LoginDao][check_player] user_id:{} ok:{} code:{} result_name:{}", user_id, check_ok, code, result_name) end return check_ok, code end) diff --git a/server/login/login_mgr.lua b/server/login/login_mgr.lua index 77fbb92a..c67dd279 100644 --- a/server/login/login_mgr.lua +++ b/server/login/login_mgr.lua @@ -27,15 +27,15 @@ end --客户端连上 function LoginMgr:on_socket_accept(session) - log_debug("[LoginMgr][on_socket_accept] %s connected!", session.token) + log_debug("[LoginMgr][on_socket_accept] {} connected!", session.token) end --客户端连接断开 function LoginMgr:on_socket_error(session, token, err) - log_debug("[LoginMgr][on_socket_error] %s lost, because: %s!", token, err) + log_debug("[LoginMgr][on_socket_error] {} lost, because: {}!", token, err) local account = session.account if account then - log_debug("[LoginMgr][on_socket_error] (t:%s-o:%s-u:%s) lost, because: %s!", token, account.open_id, account.user_id, err) + log_debug("[LoginMgr][on_socket_error] (t:{}-o:{}-u:{}) lost, because: {}!", token, account.open_id, account.user_id, err) end end @@ -43,7 +43,7 @@ end function LoginMgr:on_socket_cmd(session, service_type, cmd_id, body, session_id) local result = event_mgr:notify_listener("on_proto_filter", cmd_id, service_type) if result[1] and result[2] then - log_warn("[LoginMgr][on_socket_cmd] on_proto_filter false, cmd_id=%s", cmd_id) + log_warn("[LoginMgr][on_socket_cmd] on_proto_filter false, cmd_id={}", cmd_id) client_mgr:callback_errcode(session, cmd_id, FRAME_UPHOLD, session_id) return end diff --git a/server/login/login_servlet.lua b/server/login/login_servlet.lua index 043e1654..2ca0c416 100644 --- a/server/login/login_servlet.lua +++ b/server/login/login_servlet.lua @@ -56,7 +56,7 @@ end --账号登陆 function LoginServlet:on_account_login_req(session, cmd_id, body, session_id) local open_id, access_token, platform = body.openid, body.session, body.platform - log_debug("[LoginServlet][on_account_login_req] open_id(%s) token(%s) body:%s login req!", open_id, access_token, body) + log_debug("[LoginServlet][on_account_login_req] open_id({}) token({}) body:{} login req!", open_id, access_token, body) if session.account then return client_mgr:callback_errcode(session, cmd_id, ACCOUTN_INLINE, session_id) end @@ -68,7 +68,7 @@ function LoginServlet:on_account_login_req(session, cmd_id, body, session_id) local ok, code, sdk_open_id, sdk_device_id = tunpack(result) local login_failed, login_code = qfailed(code, ok) if login_failed then - log_err("[LoginServlet][on_account_login_req] verify failed! open_id: %s token:%s code:%s", open_id, access_token, login_code) + log_err("[LoginServlet][on_account_login_req] verify failed! open_id: {} token:{} code:{}", open_id, access_token, login_code) client_mgr:callback_errcode(session, cmd_id, login_code, session_id) return false end @@ -78,25 +78,25 @@ function LoginServlet:on_account_login_req(session, cmd_id, body, session_id) --加载账号信息 local account = login_dao:load_account(open_id) if not account then - log_err("[LoginServlet][on_account_login_req] load account failed! open_id: %s token:%s", open_id, access_token) + log_err("[LoginServlet][on_account_login_req] load account failed! open_id: {} token:{}", open_id, access_token) return client_mgr:callback_errcode(session, cmd_id, FRAME_FAILED, session_id) end --创建账号 if account:is_newbee() then if not account:create(access_token, device_id, account_params) then - log_err("[LoginServlet][on_account_login_req] open_id(%s) create account failed!", open_id) + log_err("[LoginServlet][on_account_login_req] open_id({}) create account failed!", open_id) return client_mgr:callback_errcode(session, cmd_id, FRAME_FAILED, session_id) end session.account = account event_mgr:notify_listener("on_account_create", account, device_id, session.ip, account_params.lang, account_params.dev_plat) client_mgr:callback_by_id(session, cmd_id, account:pack2client(), session_id) - log_info("[LoginServlet][on_account_login_req] newbee success! open_id: %s", open_id) + log_info("[LoginServlet][on_account_login_req] newbee success! open_id: {}", open_id) return end --密码验证 if platform == PLATFORM_PASSWORD and account:get_token() ~= access_token then - log_err("[LoginServlet][on_password_login] verify failed! open_id: %s token: %s-%s", open_id, access_token, account:get_token()) + log_err("[LoginServlet][on_password_login] verify failed! open_id: {} token: {}-{}", open_id, access_token, account:get_token()) return client_mgr:callback_errcode(session, cmd_id, VERIFY_FAILED, session_id) end session.account = account @@ -105,144 +105,144 @@ function LoginServlet:on_account_login_req(session, cmd_id, body, session_id) account:update_params(account_params) event_mgr:notify_listener("on_account_login", account:get_user_id(), open_id, device_id, session.ip, account_params.lang, account_params.dev_plat) if not client_mgr:callback_by_id(session, cmd_id, account:pack2client(), session_id) then - log_info("[LoginServlet][on_account_login_req] callback failed! open_id: %s, user_id: %s", open_id, account:get_user_id()) + log_info("[LoginServlet][on_account_login_req] callback failed! open_id: {}, user_id: {}", open_id, account:get_user_id()) return end - log_info("[LoginServlet][on_account_login_req] success! open_id: %s, user_id: %s", open_id, account:get_user_id()) + log_info("[LoginServlet][on_account_login_req] success! open_id: {}, user_id: {}", open_id, account:get_user_id()) end --创建角色 function LoginServlet:on_role_create_req(session, cmd_id, body, session_id) local user_id, name = body.user_id, body.name - log_debug("[LoginServlet][on_role_create_req] user(%s) name(%s) create role req!", user_id, name) + log_debug("[LoginServlet][on_role_create_req] user({}) name({}) create role req!", user_id, name) local account = session.account if not account or account.user_id ~= user_id then - log_err("[LoginServlet][on_role_create_req] user_id(%s) need login!", user_id) + log_err("[LoginServlet][on_role_create_req] user_id({}) need login!", user_id) return client_mgr:callback_errcode(session, cmd_id, ACCOUTN_OFFLINE, session_id) end if account:get_role_count() > 1 then - log_err("[LoginServlet][on_role_create_req] user_id(%s) role num limit!", user_id) + log_err("[LoginServlet][on_role_create_req] user_id({}) role num limit!", user_id) return client_mgr:callback_errcode(session, cmd_id, ROLE_NUM_LIMIT, session_id) end --检查名称合法性 local ok, codatas = login_dao:check_player(user_id, name) - log_debug("[LoginServlet][on_role_create_req] ok:%s codatas:%s", ok, codatas) + log_debug("[LoginServlet][on_role_create_req] ok:{} codatas:{}", ok, codatas) if not ok then return client_mgr:callback_errcode(session, cmd_id, codatas, session_id) end --创建角色 local role_id = codatas[3] if not login_dao:create_player(account:get_open_id(), role_id, body) then - log_err("[LoginServlet][on_role_create_req] user_id(%s) create role failed!", user_id) + log_err("[LoginServlet][on_role_create_req] user_id({}) create role failed!", user_id) return client_mgr:callback_errcode(session, cmd_id, FRAME_FAILED, session_id) end account:save_roles_field(role_id, body) event_mgr:notify_listener("on_role_create", user_id, role_id, body) local rdata = { role_id = role_id, gender = body.gender, name = body.name } if not client_mgr:callback_by_id(session, cmd_id, { error_code = 0, role = rdata }, session_id) then - log_info("[LoginServlet][on_role_create_req] user_id(%s) create role %s callback failed!", user_id, name) + log_info("[LoginServlet][on_role_create_req] user_id({}) create role {} callback failed!", user_id, name) return end - log_info("[LoginServlet][on_role_create_req] user_id(%s) create role %s success!", user_id, name) + log_info("[LoginServlet][on_role_create_req] user_id({}) create role {} success!", user_id, name) end --选择角色 function LoginServlet:on_role_choose_req(session, cmd_id, body, session_id) local user_id, role_id = body.user_id, body.role_id - log_debug("[LoginServlet][on_role_choose_req] user_id(%s) role_id(%s) choose req!", user_id, role_id) + log_debug("[LoginServlet][on_role_choose_req] user_id({}) role_id({}) choose req!", user_id, role_id) local account = session.account if not account then - log_err("[LoginServlet][on_role_choose_req] user_id(%s) need login!", user_id) + log_err("[LoginServlet][on_role_choose_req] user_id({}) need login!", user_id) return client_mgr:callback_errcode(session, cmd_id, ACCOUTN_OFFLINE, session_id) end local role = account:get_role(role_id) if not role then - log_err("[LoginServlet][on_role_choose_req] user_id(%s) role_id(%s) role nit exist!", user_id, role_id) + log_err("[LoginServlet][on_role_choose_req] user_id({}) role_id({}) role nit exist!", user_id, role_id) return client_mgr:callback_errcode(session, cmd_id, ROLE_NOT_EXIST, session_id) end local fok, gateway = self:find_gateway(account) - log_debug("[LoginServlet][on_role_choose_req] choose gateway(%s)!", gateway) + log_debug("[LoginServlet][on_role_choose_req] choose gateway({})!", gateway) if not fok then - log_err("[LoginServlet][on_role_choose_req] user_id(%s) role_id(%s) server uphold!", user_id, role_id) + log_err("[LoginServlet][on_role_choose_req] user_id({}) role_id({}) server uphold!", user_id, role_id) return client_mgr:callback_errcode(session, cmd_id, SERVER_UPHOLD, session_id) end local ok, code = router_mgr:call_target(gateway.lobby, "rpc_update_login_token", account.open_id, gateway.token) if qfailed(code, ok) then - log_err("[LoginServlet][on_role_choose_req] user_id(%s) role_id(%s) update token failed!", user_id, role_id) + log_err("[LoginServlet][on_role_choose_req] user_id({}) role_id({}) update token failed!", user_id, role_id) return client_mgr:callback_errcode(session, cmd_id, SERVER_UPHOLD, session_id) end account:save_lobby(gateway.lobby) if not client_mgr:callback_by_id(session, cmd_id, gateway, session_id) then - log_info("[LoginServlet][on_role_choose_req] user_id(%s) role_id(%s) callback failed!", user_id, role_id) + log_info("[LoginServlet][on_role_choose_req] user_id({}) role_id({}) callback failed!", user_id, role_id) return end - log_info("[LoginServlet][on_role_choose_req] user_id(%s) role_id(%s) choose success!", user_id, role_id) + log_info("[LoginServlet][on_role_choose_req] user_id({}) role_id({}) choose success!", user_id, role_id) end --删除角色 function LoginServlet:on_role_delete_req(session, cmd_id, body, session_id) local user_id, role_id = body.user_id, body.role_id - log_debug("[LoginServlet][on_role_delete_req] user_id(%s) role_id(%s) delete req!", user_id, role_id) + log_debug("[LoginServlet][on_role_delete_req] user_id({}) role_id({}) delete req!", user_id, role_id) local account = session.account if not account or account:get_user_id() ~= user_id then - log_err("[LoginServlet][on_role_delete_req] user_id(%s) need login!", user_id) + log_err("[LoginServlet][on_role_delete_req] user_id({}) need login!", user_id) return client_mgr:callback_errcode(session, cmd_id, ACCOUTN_OFFLINE, session_id) end if not account:del_role(role_id) then - log_err("[LoginServlet][on_role_delete_req] user_id(%s) role_id(%s) role nit exist!", user_id, role_id) + log_err("[LoginServlet][on_role_delete_req] user_id({}) role_id({}) role nit exist!", user_id, role_id) return client_mgr:callback_errcode(session, cmd_id, ROLE_NOT_EXIST, session_id) end if not client_mgr:callback_errcode(session, cmd_id, FRAME_SUCCESS, session_id) then - log_info("[LoginServlet][on_role_delete_req] user_id(%s) role_id(%s) callback failed!", user_id, role_id) + log_info("[LoginServlet][on_role_delete_req] user_id({}) role_id({}) callback failed!", user_id, role_id) return end - log_info("[LoginServlet][on_role_delete_req] user_id(%s) role_id(%s) delete success!", user_id, role_id) + log_info("[LoginServlet][on_role_delete_req] user_id({}) role_id({}) delete success!", user_id, role_id) end --账号重登 function LoginServlet:on_account_reload_req(session, cmd_id, body, session_id) local open_id, token, device_id = body.openid, body.session, body.device_id - log_debug("[LoginServlet][on_account_reload_req] openid(%s) token(%s) reload req!", open_id, token) + log_debug("[LoginServlet][on_account_reload_req] openid({}) token({}) reload req!", open_id, token) if session.account then return client_mgr:callback_errcode(session, cmd_id, ACCOUTN_INLINE, session_id) end --验证token local account = login_dao:load_account(open_id) if not account then - log_err("[LoginServlet][on_account_login_req] load account failed! open_id: %s token:%s", open_id, token) + log_err("[LoginServlet][on_account_login_req] load account failed! open_id: {} token:{}", open_id, token) return client_mgr:callback_errcode(session, cmd_id, FRAME_FAILED, session_id) end if account:is_newbee() then - log_err("[LoginServlet][on_account_reload_req] open_id(%s) load account status failed!", open_id) + log_err("[LoginServlet][on_account_reload_req] open_id({}) load account status failed!", open_id) return client_mgr:callback_errcode(session, cmd_id, FRAME_FAILED, session_id) end local old_token = account:get_token() if token ~= old_token or device_id ~= account:get_device_id() then - log_err("[LoginServlet][on_account_reload_req] verify failed! open_id: %s, token: %s-%s", open_id, token, old_token) + log_err("[LoginServlet][on_account_reload_req] verify failed! open_id: {}, token: {}-{}", open_id, token, old_token) return client_mgr:callback_errcode(session, cmd_id, VERIFY_FAILED, session_id) end session.account = account if not client_mgr:callback_by_id(session, cmd_id, account:pack2client(), session_id) then - log_info("[LoginServlet][on_account_reload_req] callback failed! open_id: %s", open_id) + log_info("[LoginServlet][on_account_reload_req] callback failed! open_id: {}", open_id) return end - log_info("[LoginServlet][on_account_reload_req] success! open_id: %s, user_id: %s", open_id, account:get_user_id()) + log_info("[LoginServlet][on_account_reload_req] success! open_id: {}, user_id: {}", open_id, account:get_user_id()) end --随机名字 function LoginServlet:on_random_name_req(session, cmd_id, body, session_id) local rname = guid_encode() - log_debug("[LoginServlet][on_random_name_req] open_id(%s) randname: %s!", session.open_id, rname) + log_debug("[LoginServlet][on_random_name_req] open_id({}) randname: {}!", session.open_id, rname) local callback_data = { error_code = 0, name = rname } if not client_mgr:callback_by_id(session, cmd_id, callback_data, session_id) then - log_info("[LoginServlet][on_random_name_req] callback failed! open_id: %s", session.open_id) + log_info("[LoginServlet][on_random_name_req] callback failed! open_id: {}", session.open_id) end end --网关和lobby相关接口 ---------------------------------------------------------------- function LoginServlet:on_service_close(id, name, info) - log_debug("[LoginServlet][on_service_close] node: %s-%s", name, id) + log_debug("[LoginServlet][on_service_close] node: {}-{}", name, id) if name == "lobby" then self.lobbys[id] = nil return @@ -258,7 +258,7 @@ function LoginServlet:on_service_close(id, name, info) end function LoginServlet:on_service_ready(id, name, info) - log_debug("[LoginServlet][on_service_ready] node: %s-%s, info: %s", name, id, info) + log_debug("[LoginServlet][on_service_ready] node: {}-{}, info: {}", name, id, info) if name == "lobby" then self.lobbys[id] = info return diff --git a/server/monitor/hotfix_mgr.lua b/server/monitor/hotfix_mgr.lua index d268f94b..b2297e27 100644 --- a/server/monitor/hotfix_mgr.lua +++ b/server/monitor/hotfix_mgr.lua @@ -35,10 +35,10 @@ function HotfixMgr:setup() thread_mgr:fork(function() self.config = import("hotfix/version.lua") self.dictionary = import("hotfix/dictionary.lua") - log_debug("[HotfixMgr][init_nacos] versions:%s", self.config) + log_debug("[HotfixMgr][init_nacos] versions:{}", self.config) --回调函数 local config_changed = function(data_id, group, md5, cvalue) - log_debug("[HotfixMgr][config_changed]: dataid:%s md5:%s", data_id, md5) + log_debug("[HotfixMgr][config_changed]: dataid:{} md5:{}", data_id, md5) self:hotfix_callback(group, md5, cvalue) end nacos:listen_config(self.config.data_id, self.config.group, self.config.md5, config_changed) @@ -76,11 +76,11 @@ end function HotfixMgr:update_config(data_id, group, path) local content = nacos:get_config(data_id, group); if not content then - log_warn("[HotfixMgr][update_config] update script:%s failed!", path) + log_warn("[HotfixMgr][update_config] update script:{} failed!", path) return end self:encrypt(path, content) - log_debug("[HotfixMgr][update_config] update script: %s success!", path) + log_debug("[HotfixMgr][update_config] update script: {} success!", path) end --热更 @@ -88,7 +88,7 @@ function HotfixMgr:hotfix_callback(group, md5, cvalue) --加载字典文件 local dic_func, err = load(cvalue) if not dic_func then - log_warn("[HotfixMgr][hotfix_callback] load dictionary failed: %s !", err) + log_warn("[HotfixMgr][hotfix_callback] load dictionary failed: {} !", err) return end --更新版本配置 diff --git a/server/monitor/monitor_mgr.lua b/server/monitor/monitor_mgr.lua index 38079cf5..4bf3b9ae 100644 --- a/server/monitor/monitor_mgr.lua +++ b/server/monitor/monitor_mgr.lua @@ -66,7 +66,7 @@ end function MonitorMgr:on_client_register(client, node) local token = client.token - log_debug("[MonitorMgr][on_service_register] node:%s, token: %s", node.name, token) + log_debug("[MonitorMgr][on_service_register] node:{}, token: {}", node.name, token) self.discovery:register(node) self.monitor_nodes[token] = node --返回所有服务 @@ -80,7 +80,7 @@ end -- 会话关闭回调 function MonitorMgr:on_client_error(client, token, err) - log_info("[MonitorMgr][on_client_error] node:%s, token:%s", client.name, token) + log_info("[MonitorMgr][on_client_error] node:{}, token:{}", client.name, token) local node = self.monitor_nodes[token] if node then self.discovery:unregister(client.id) @@ -114,7 +114,7 @@ end -- command处理 function MonitorMgr:on_monitor_command(url, body) - log_debug("[MonitorMgr][on_monitor_command]: %s", body) + log_debug("[MonitorMgr][on_monitor_command]: {}", body) --执行函数 local function handler_cmd(jbody) if body.token then @@ -125,7 +125,7 @@ function MonitorMgr:on_monitor_command(url, body) --开始执行 local ok, res = pcall(handler_cmd, body) if not ok then - log_warn("[MonitorMgr:on_monitor_post] pcall: %s", res) + log_warn("[MonitorMgr:on_monitor_post] pcall: {}", res) return {code = 1, msg = res} end return res @@ -138,7 +138,7 @@ function MonitorMgr:on_server_shutdown(url, body, request) self:broadcast_all("rpc_server_shutdown") -- 关闭会话连接 timer_mgr:loop(SECOND_10_MS, function() - log_warn("[MonitorMgr][on_server_shutdown]->service:%s", quanta.name) + log_warn("[MonitorMgr][on_server_shutdown]->service:{}", quanta.name) signal_quit() end) diff --git a/server/monitor/nacos_discovery.lua b/server/monitor/nacos_discovery.lua index 13d45fc5..5348c524 100644 --- a/server/monitor/nacos_discovery.lua +++ b/server/monitor/nacos_discovery.lua @@ -56,7 +56,7 @@ function NacosDiscovery:refresh_services() local old = self.services[service_name] local sadd, sdel = tdiff(old, curr) if next(sadd) or next(sdel) then - log_debug("[NacosDiscovery][check_services] sadd:%s, sdel: %s", sadd, sdel) + log_debug("[NacosDiscovery][check_services] sadd:{}, sdel: {}", sadd, sdel) self.trigger:broadcast("rpc_service_changed", service_name, sadd, sdel) self.services[service_name] = curr --设置状态 @@ -101,7 +101,7 @@ function NacosDiscovery:unregister(node_id) local sdata = self.locals[node_id] if sdata then self.locals[node_id] = nil - log_debug("[RedisDiscovery][unregister] node %s", node_id) + log_debug("[RedisDiscovery][unregister] node {}", node_id) nacos:del_instance(sdata.service_name, sdata.host, sdata.port) self:refresh_services() end diff --git a/server/monitor/redis_discovery.lua b/server/monitor/redis_discovery.lua index e84de456..203b1ddf 100644 --- a/server/monitor/redis_discovery.lua +++ b/server/monitor/redis_discovery.lua @@ -93,7 +93,7 @@ function RedisDiscovery:on_subscribe_ready(channel, data) local node_id = node_data.id local sname = sid2name(node_id) if channel == CHANNEL_UP then - log_debug("[RedisDiscovery][quanta_register] data:%s", data) + log_debug("[RedisDiscovery][quanta_register] data:{}", data) if sname == "router" then self.routers[node_id] = node_data self.trigger:broadcast("rpc_service_changed", sname, { [node_id] = node_data }, {}) @@ -103,7 +103,7 @@ function RedisDiscovery:on_subscribe_ready(channel, data) self.trigger:broadcast_legal("rpc_service_changed", sname, { [node_id] = node_data }, {}) end if channel == CHANNEL_DN then - log_debug("[RedisDiscovery][quanta_unregister] data:%s", data) + log_debug("[RedisDiscovery][quanta_unregister] data:{}", data) if sname == "router" then self.routers[node_id] = nil self.trigger:broadcast("rpc_service_changed", sname, {}, { [node_id] = node_data }) @@ -142,7 +142,7 @@ function RedisDiscovery:unregister(node_id) local sdata = self.locals[node_id] if sdata then self.locals[node_id] = nil - log_debug("[RedisDiscovery][unregister] node %s", node_id) + log_debug("[RedisDiscovery][unregister] node {}", node_id) self:del_instance(sdata) end end @@ -157,7 +157,7 @@ function RedisDiscovery:query_instances() repeat local ok, next_cur, datas = self.redis:execute("HSCAN", SERVICE_KEY, cur, "count", 200) if not ok or not next_cur or not datas then - log_err("[RedisDiscovery][query_instances] query failed: cur:%s, datas:%s", next_cur, datas) + log_err("[RedisDiscovery][query_instances] query failed: cur:{}, datas:{}", next_cur, datas) return end for node_data, score in pairs(datas) do diff --git a/server/router/router_server.lua b/server/router/router_server.lua index 53ee91a3..0065fcd4 100644 --- a/server/router/router_server.lua +++ b/server/router/router_server.lua @@ -37,18 +37,18 @@ end --其他服务器节点关闭 function RouterServer:on_client_error(client, client_token, err) - log_info("[RouterServer][on_client_error] %s lost: %s", client.name, err) + log_info("[RouterServer][on_client_error] {} lost: {}", client.name, err) local new_master = socket_mgr.map_token(client.id) - log_info("[RouterServer][on_socket_error] %s master --> %s", client.service_name, new_master) + log_info("[RouterServer][on_socket_error] {} master --> {}", client.service_name, new_master) end --accept事件 function RouterServer:on_client_accept(client) - log_info("[RouterServer][on_client_accept] new connection, token=%s", client.token) + log_info("[RouterServer][on_client_accept] new connection, token={}", client.token) client.on_forward_error = function(session_id, target_id, source_id, rpc) thread_mgr:fork(function() local target, source = id2name(target_id), id2name(source_id) - log_err("[RouterServer][on_client_accept] on_forward_error, ssid:%s, tar:%s, src:%s, rpc:%s)", session_id, target, source, rpc) + log_err("[RouterServer][on_client_accept] on_forward_error, ssid:{}, tar:{}, src:{}, rpc:{})", session_id, target, source, rpc) self.rpc_server:callback(client, session_id, false, UNREACHABLE, "router con't find target!") end) end @@ -63,9 +63,9 @@ end ------------------------------------------------------------------ --注册服务器 function RouterServer:on_client_register(client, node, client_id) - log_info("[RouterServer][on_client_register] service: %s", client.name) + log_info("[RouterServer][on_client_register] service: {}", client.name) local new_master = socket_mgr.map_token(client_id, client.token) - log_info("[RouterServer][on_client_register] %s master --> %s", client.service_name, new_master) + log_info("[RouterServer][on_client_register] {} master --> {}", client.service_name, new_master) end -- 会话信息 diff --git a/server/router/transfer_mgr.lua b/server/router/transfer_mgr.lua index 39fc7cb0..6ce6f9c4 100644 --- a/server/router/transfer_mgr.lua +++ b/server/router/transfer_mgr.lua @@ -39,7 +39,7 @@ end ------------------------------------------------------------------------------ --踢出玩家 function TransferMgr:rpc_router_clean(client, player_id) - log_info("[TransferMgr][rpc_router_clean] player_id : %s", player_id) + log_info("[TransferMgr][rpc_router_clean] player_id : {}", player_id) self.routers[player_id] = nil return SUCCESS end @@ -48,10 +48,10 @@ end function TransferMgr:rpc_login_service(client, player_id, serv_name, serv_id) local routers = self:update_service(player_id, serv_name, serv_id) if routers then - log_info("[TransferMgr][rpc_login_service]: %s, service: %s-%s", player_id, serv_name, serv_id) + log_info("[TransferMgr][rpc_login_service]: {}, service: {}-{}", player_id, serv_name, serv_id) return SUCCESS end - log_warn("[TransferMgr][rpc_login_service]: %s, service: %s-%s failed!", player_id, serv_name, serv_id) + log_warn("[TransferMgr][rpc_login_service]: {}, service: {}-{} failed!", player_id, serv_name, serv_id) return RPC_FAILED end @@ -73,7 +73,7 @@ function TransferMgr:on_broadcast_rpc(client, player_id, slice) routers = self:query_routers(player_id, NODE_ID) end if not routers then - log_warn("[TransferMgr][on_broadcast_rpc]: %s find routers failed!", player_id) + log_warn("[TransferMgr][on_broadcast_rpc]: {} find routers failed!", player_id) return end for _, server_id in pairs(routers) do @@ -95,7 +95,7 @@ function TransferMgr:on_transfer_rpc(client, session_id, service_id, player_id, if session_id > 0 then self.rpc_server:callback(client, session_id, false, PLAYER_NOT_EXIST) end - log_warn("[TransferMgr][on_transfer_rpc]: %s, service: %s failed!", player_id, serv_name) + log_warn("[TransferMgr][on_transfer_rpc]: {}, service: {} failed!", player_id, serv_name) return end self.rpc_server:transfer_call(session_id, routers[serv_name], slice) @@ -122,7 +122,7 @@ function TransferMgr:update_service(pla_id, serv_name, serv_id) local routers = self:query_routers(pla_id, router_id, serv_name, serv_id) if not routers then self.routers[pla_id][serv_name] = old_serv_id - log_warn("[TransferMgr][update_service]: %s service: %s failed!", pla_id, serv_name) + log_warn("[TransferMgr][update_service]: {} service: {} failed!", pla_id, serv_name) return end return routers @@ -136,7 +136,7 @@ function TransferMgr:query_service(player_id, serv_name) end local rrouters = self:query_routers(player_id, NODE_ID) if not rrouters then - log_warn("[TransferMgr][query_service]: %s service: %s failed!", player_id, serv_name) + log_warn("[TransferMgr][query_service]: {} service: {} failed!", player_id, serv_name) return RPC_FAILED end return SUCCESS, rrouters[serv_name] diff --git a/server/test/bitarray_test.lua b/server/test/bitarray_test.lua index 42830bfc..8a0311ac 100644 --- a/server/test/bitarray_test.lua +++ b/server/test/bitarray_test.lua @@ -3,28 +3,28 @@ local log_debug = logger.debug local array = codec.bitarray(32) -log_debug("array1: %s", array.to_string()) +log_debug("array1: {}", array.to_string()) array.fill(1) -log_debug("array11: %s", array.to_string()) +log_debug("array11: {}", array.to_string()) array.flip(1) -log_debug("array12: %s", array.to_string()) +log_debug("array12: {}", array.to_string()) array.flip_bit(3) -log_debug("array13: %s-%s", array.to_string(), array.get_bit(3)) +log_debug("array13: {}-{}", array.to_string(), array.get_bit(3)) array.from_uint32(65535) -log_debug("array2: %s-%s", array.to_string(), array.to_uint32()) +log_debug("array2: {}-{}", array.to_string(), array.to_uint32()) array.rshift(1) -log_debug("array3: %s-%s", array.to_string(), array.to_uint32()) +log_debug("array3: {}-{}", array.to_string(), array.to_uint32()) array.lshift(1) -log_debug("array4: %s-%s", array.to_string(), array.to_uint32()) +log_debug("array4: {}-{}", array.to_string(), array.to_uint32()) array.set_bit(32, 1) local a2 = array.clone() -log_debug("array5: %s", a2.to_string()) +log_debug("array5: {}", a2.to_string()) local a3 = a2.slice(1, 16) -log_debug("array51: %s", a3.to_string()) +log_debug("array51: {}", a3.to_string()) local a4 = a2.slice(17) -log_debug("array52: %s", a4.to_string()) +log_debug("array52: {}", a4.to_string()) a4.concat(a3) -log_debug("array6: %s", a4.to_string()) +log_debug("array6: {}", a4.to_string()) a4.reverse() -log_debug("array7: %s", a4.to_string()) -log_debug("array8: %s-%s", a4.equal(a2), a3.equal(a2)) +log_debug("array7: {}", a4.to_string()) +log_debug("array8: {}-{}", a4.equal(a2), a3.equal(a2)) diff --git a/server/test/clickhouse_test.lua b/server/test/clickhouse_test.lua index d1fe1bf9..d6af8146 100644 --- a/server/test/clickhouse_test.lua +++ b/server/test/clickhouse_test.lua @@ -10,14 +10,14 @@ local MAIN_DBID = environ.number("QUANTA_DB_MAIN_ID") timer_mgr:once(2000, function() local code, res_oe = ck_mgr:query(MAIN_DBID, MAIN_DBID, "drop table if exists test_ck") - log_debug("db drop table code: %s, err = %s", code, res_oe) + log_debug("db drop table code: {}, err = {}", code, res_oe) code, res_oe = ck_mgr:query(MAIN_DBID, MAIN_DBID, "create table if not exists test_ck (id int, pid int, value int, primary key (id)) ENGINE = MergeTree") - log_debug("db create table code: %s, err = %s", code, res_oe) + log_debug("db create table code: {}, err = {}", code, res_oe) code, res_oe = ck_mgr:query(MAIN_DBID, MAIN_DBID, "select count(*) as count from test_ck where pid=123456") - log_debug("db select code: %s, count = %s", code, res_oe) + log_debug("db select code: {}, count = {}", code, res_oe) code, res_oe = ck_mgr:query(MAIN_DBID, MAIN_DBID, "insert into test_ck (id, pid, value) values (1, 123456, 40)") - log_debug("db insert code: %s, count = %s", code, res_oe) + log_debug("db insert code: {}, count = {}", code, res_oe) code, res_oe = ck_mgr:query(MAIN_DBID, MAIN_DBID, "select * from test_ck where pid = 123456") - log_debug("db select code: %s, res_oe = %s", code, res_oe) + log_debug("db select code: {}, res_oe = {}", code, res_oe) end) diff --git a/server/test/cmdline_test.lua b/server/test/cmdline_test.lua index 87e29dcf..b940f6f2 100644 --- a/server/test/cmdline_test.lua +++ b/server/test/cmdline_test.lua @@ -33,7 +33,7 @@ for _, command in pairs(commands) do for i, value in ipairs(result.args) do local atype = type(value) local name = result.info[i] - log_debug("parse command %s args->(%s, %s[%s])", command.name, name, value, atype) + log_debug("parse command {} args->({}, {}[{}])", command.name, name, value, atype) end end local result2 = cmdline:parser_data(command.data) @@ -41,7 +41,7 @@ for _, command in pairs(commands) do for i, value in ipairs(result2.args) do local atype = type(value) local name = result2.info[i] - log_debug("parse data %s args->(%s, %s[%s])", command.name, name, value, atype) + log_debug("parse data {} args->({}, {}[{}])", command.name, name, value, atype) end end end diff --git a/server/test/codec_test.lua b/server/test/codec_test.lua index 66708322..3b132a8b 100644 --- a/server/test/codec_test.lua +++ b/server/test/codec_test.lua @@ -30,65 +30,65 @@ codec.ketama_insert("test10", quanta.id + 9) local map = codec.ketama_map() local qmap = qtable.mapsort(map) for _, value in pairs(qmap) do - log_debug("ketama_map: %s, %s", value[1], value[2]) + log_debug("ketama_map: {}, {}", value[1], value[2]) end -log_debug("ketama_insert number: %s", qtable.size(map)) +log_debug("ketama_insert number: {}", qtable.size(map)) ]] --hash ---------------------------------------------------------------- local hash_n1 = hash_code(12345) local hash_n2 = hash_code(123346456545464, 1000) -log_debug("hash_code number: %s, %s", hash_n1, hash_n2) +log_debug("hash_code number: {}, {}", hash_n1, hash_n2) local hash_s1 = hash_code("12345") local hash_s2 = hash_code("a0b0c0d0a0b0c0d0", 1000) -log_debug("hash_code string: %s, %s", hash_s1, hash_s2) +log_debug("hash_code string: {}, {}", hash_s1, hash_s2) local fnv_s1 = fnv_32("") local fnv_s2 = fnv_32("12345", fnv_s1) local fnv_s3 = fnv_32("12345", fnv_s2) -log_debug("fnv_32 string: %s, %s, %s", fnv_s1, fnv_s2, fnv_s3) +log_debug("fnv_32 string: {}, {}, {}", fnv_s1, fnv_s2, fnv_s3) local fnv_as1 = fnv_32a("12345") local fnv_as2 = fnv_32a("12345", fnv_as1) local fnv_as3 = fnv_32a("12345", fnv_as2) -log_debug("fnv_32a string: %s, %s, %s", fnv_as1, fnv_as2, fnv_as3) +log_debug("fnv_32a string: {}, {}, {}", fnv_as1, fnv_as2, fnv_as3) --fnv_32 string: 2930711257, 991336454, 3269464323 --fnv_32a string: 3601286043, 177295730, 3384461241 local jmpv = jumphash("", 3) -log_debug("jumphash value: %s", jmpv) +log_debug("jumphash value: {}", jmpv) --guid ---------------------------------------------------------------- local guid = codec.guid_new(5, 512) local sguid = codec.guid_tostring(guid) -log_debug("newguid-> guid: %s, n2s: %s", guid, sguid) +log_debug("newguid-> guid: {}, n2s: {}", guid, sguid) local nguid = codec.guid_number(sguid) local s2guid = codec.guid_tostring(nguid) -log_debug("convert-> guid: %s, n2s: %s", nguid, s2guid) +log_debug("convert-> guid: {}, n2s: {}", nguid, s2guid) local eguid = codec.guid_encode(9223372036854775807) local eguid1 = codec.guid_encode(0x7fffffffffffffff) -log_debug("encode-> eguid: %s", eguid) -log_debug("encode-> eguid: %s", eguid1) +log_debug("encode-> eguid: {}", eguid) +log_debug("encode-> eguid: {}", eguid1) local dguid = codec.guid_decode(eguid) local dguid1 = codec.guid_decode(eguid1) -log_debug("encode-> dguid: %s", dguid) -log_debug("encode-> dguid: %s", dguid1) +log_debug("encode-> dguid: {}", dguid) +log_debug("encode-> dguid: {}", dguid1) local nsguid = codec.guid_string(5, 512) -log_debug("newguid: %s", nsguid) +log_debug("newguid: {}", nsguid) local group = codec.guid_group(nsguid) local index = codec.guid_index(guid) local time = codec.guid_time(guid) -log_debug("ssource-> group: %s, index: %s, time:%s", group, index, time) +log_debug("ssource-> group: {}, index: {}, time:{}", group, index, time) local group2, index2, time2 = codec.guid_source(guid) -log_debug("nsource-> group: %s, index: %s, time:%s", group2, index2, time2) +log_debug("nsource-> group: {}, index: {}, time:{}", group2, index2, time2) -log_debug("crc8: %s", crc8("123214345345345")) -log_debug("crc8: %s", crc8("dfsdfsdfsdfgsdg")) -log_debug("crc8: %s", crc8("2213weerwbdfgd")) -log_debug("crc8: %s", crc8("++dsfsdf++gbdfgdfg")) +log_debug("crc8: {}", crc8("123214345345345")) +log_debug("crc8: {}", crc8("dfsdfsdfsdfgsdg")) +log_debug("crc8: {}", crc8("2213weerwbdfgd")) +log_debug("crc8: {}", crc8("++dsfsdf++gbdfgdfg")) --serialize ---------------------------------------------------------------- @@ -103,23 +103,23 @@ local t = { g = m, } local ss = serialize(t) -log_debug("serialize-> aaa: %s", ss) +log_debug("serialize-> aaa: {}", ss) local tt = unserialize(ss) for k, v in pairs(tt) do - log_debug("unserialize k=%s, v=%s", k, v) + log_debug("unserialize k={}, v={}", k, v) end --encode local e = {a = 1, c = {ab = 2}} local bufe = encode(e) -log_debug("encode-> bufe: %d, %s", #bufe, lhex_encode(bufe)) +log_debug("encode-> bufe: {}, {}", #bufe, lhex_encode(bufe)) local datae = decode(bufe, #bufe) -log_debug("decode-> %s", datae) +log_debug("decode-> {}", datae) local ip = luabus.dns("mtae-global-test-outer-zone-a-2-89e65514de3445cc.elb.us-east-1.amazonaws.com") -log_debug("luabus dns-> %s", ip) +log_debug("luabus dns-> {}", ip) --dump -log_dump("dump-> a: %s", t) +log_dump("dump-> a: {}", t) diff --git a/server/test/crypt_test.lua b/server/test/crypt_test.lua index c9bec11d..745c6122 100644 --- a/server/test/crypt_test.lua +++ b/server/test/crypt_test.lua @@ -25,40 +25,40 @@ local lhmac_sha512 = crypt.hmac_sha512 local ran = lrandomkey() local nonce = lb64encode(ran) local dnonce = lb64decode(nonce) -log_info("b64encode-> ran: %s, nonce: %s, dnonce:%s", lhex_encode(ran), lhex_encode(nonce), lhex_encode(dnonce)) +log_info("b64encode-> ran: {}, nonce: {}, dnonce:{}", lhex_encode(ran), lhex_encode(nonce), lhex_encode(dnonce)) --sha local value = "123456779" local sha1 = lhex_encode(lsha1(value)) -log_info("sha1: %s", sha1) +log_info("sha1: {}", sha1) local sha224 = lhex_encode(lsha224(value)) -log_info("sha224: %s", sha224) +log_info("sha224: {}", sha224) local sha256 = lhex_encode(lsha256(value)) -log_info("sha256: %s", sha256) +log_info("sha256: {}", sha256) local sha384 = lhex_encode(lsha384(value)) -log_info("sha384: %s", sha384) +log_info("sha384: {}", sha384) local sha512 = lhex_encode(lsha512(value)) -log_info("sha512: %s", sha512) +log_info("sha512: {}", sha512) --md5 local omd5 = lmd5(value) local nmd5 = lmd5(value, 1) local hmd5 = lhex_encode(omd5) -log_info("md5: %s", nmd5) -log_info("omd5: %s, hmd5: %s", omd5, hmd5) +log_info("md5: {}", nmd5) +log_info("omd5: {}, hmd5: {}", omd5, hmd5) --hmac_sha local key = "1235456" local hmac_sha1 = lhex_encode(lhmac_sha1(key, value)) -log_info("hmac_sha1: %s", hmac_sha1) +log_info("hmac_sha1: {}", hmac_sha1) local hmac_sha224 = lhex_encode(lhmac_sha224(key, value)) -log_info("hmac_sha224: %s", hmac_sha224) +log_info("hmac_sha224: {}", hmac_sha224) local hmac_sha256 = lhex_encode(lhmac_sha256(key, value)) -log_info("hmac_sha256: %s", hmac_sha256) +log_info("hmac_sha256: {}", hmac_sha256) local hmac_sha384 = lhex_encode(lhmac_sha384(key, value)) -log_info("hmac_sha384: %s", hmac_sha384) +log_info("hmac_sha384: {}", hmac_sha384) local hmac_sha512 = lhex_encode(lhmac_sha512(key, value)) -log_info("hmac_sha512: %s", hmac_sha512) +log_info("hmac_sha512: {}", hmac_sha512) --rsa local pem_pub = [[ @@ -85,20 +85,20 @@ RfSHi27F/Ew6pENe4AwY2sfEV2TXrwEdrvfjNWFSPw== ]] local pub_pem_b64 = lb64decode(string.gsub(pem_pub, "\n", "") ) -log_info("pub_pem_b64: %s", lhex_encode(pub_pem_b64)) +log_info("pub_pem_b64: {}", lhex_encode(pub_pem_b64)) local pri_pem_b64 = lb64decode(string.gsub(pem_pri, "\n", "") ) -log_info("pri_pem_b64: %s", lhex_encode(pri_pem_b64)) +log_info("pri_pem_b64: {}", lhex_encode(pri_pem_b64)) local code1 = rsa_init_pkey(pub_pem_b64) local code2 = rsa_init_skey(pri_pem_b64) -log_info("rsa_init: %s, %s", code1, code2) +log_info("rsa_init: {}, {}", code1, code2) local rsav1 = crypt.rsa_pencode("xiyoo0812") -log_info("rsa_pencode: %s, %s", #rsav1, lhex_encode(rsav1)) +log_info("rsa_pencode: {}, {}", #rsav1, lhex_encode(rsav1)) local rsav2 = crypt.rsa_sdecode(rsav1) -log_info("rsa_sdecode: %s", rsav2) +log_info("rsa_sdecode: {}", rsav2) local rsav3 = crypt.rsa_sencode("xiyoo0812") -log_info("rsa_sencode: %s, %s", #rsav3, lhex_encode(rsav3)) +log_info("rsa_sencode: {}, {}", #rsav3, lhex_encode(rsav3)) local rsav4 = crypt.rsa_pdecode(rsav3) -log_info("rsa_pdecode: %s", rsav4) +log_info("rsa_pdecode: {}", rsav4) diff --git a/server/test/detour_test.lua b/server/test/detour_test.lua index 99790665..5d8c61e7 100644 --- a/server/test/detour_test.lua +++ b/server/test/detour_test.lua @@ -17,7 +17,7 @@ if not mesh then end local tiles = mesh.get_max_tiles() -log_debug("load navmesh success, tiles : %s!", tiles) +log_debug("load navmesh success, tiles : {}!", tiles) local query = mesh.create_query(64, 1) if not query then log_err("create navmesh query failed!") @@ -29,17 +29,17 @@ for i = 1, 33000 do local x1, y1, z1 = query.random_point() local x2, y2, z2 = query.random_point() if (not query.point_valid(x1, y1, z1)) then - log_err('point (%s, %s, %s) is not valid', x1, y1, z1) + log_err('point ({}, {}, {}) is not valid', x1, y1, z1) end query.find_path(x1, y1, z1, x2, y2, z2) end local t2 = timer.time() -log_debug("find_path : %s!", t2 - t1) +log_debug("find_path : {}!", t2 - t1) local pos_x, pos_y, pos_z = query.random_point() --- log_debug('pos: %s', { x = pos_x, y = pos_y, z = pos_z, }) +-- log_debug('pos: {}', { x = pos_x, y = pos_y, z = pos_z, }) local rnd_x, rnd_y, rnd_z = query.around_point(pos_x, pos_y, pos_z, 30) --- log_debug('rnd: %s', { x = rnd_x, y = rnd_y, z = rnd_z, }) +-- log_debug('rnd: {}', { x = rnd_x, y = rnd_y, z = rnd_z, }) if (not query.point_valid(rnd_x, rnd_y, rnd_z)) then - log_err('point (%s, %s, %s) is not valid', rnd_x, rnd_y, rnd_z) + log_err('point ({}, {}, {}) is not valid', rnd_x, rnd_y, rnd_z) end diff --git a/server/test/http_test.lua b/server/test/http_test.lua index 9dbad731..7eda90df 100644 --- a/server/test/http_test.lua +++ b/server/test/http_test.lua @@ -10,19 +10,19 @@ local data = {aaa = 123} if quanta.index == 1 then local on_post = function(path, body, params) - log_debug("on_post: %s, %s, %s", path, body, params) + log_debug("on_post: {}, {}, {}", path, body, params) return data end local on_get = function(path, params) - log_debug("on_get: %s, %s", path, params) + log_debug("on_get: {}, {}", path, params) return data end local on_put = function(path, body, params) - log_debug("on_put: %s, %s, %s", path, body, params) + log_debug("on_put: {}, {}, {}", path, body, params) return data end local on_del = function(path, params) - log_debug("on_del: %s, %s", path, params) + log_debug("on_del: {}, {}", path, params) return data end local HttpServer = import("network/http_server.lua") @@ -37,27 +37,27 @@ elseif quanta.index == 2 then local tk1 = ltime() thread_mgr:fork(function() local tk2 = ltime() - log_debug("node_status1 : %s, %s, %s", tk2 - tk1, tk2, tk1) + log_debug("node_status1 : {}, {}, {}", tk2 - tk1, tk2, tk1) local ok, status, res = http_client:call_post("http://127.0.0.1:8888/node_status1", data) - log_debug("node_status1 : %s, %s, %s, %s", ltime() - tk2, ok, status, res) + log_debug("node_status1 : {}, {}, {}, {}", ltime() - tk2, ok, status, res) end) thread_mgr:fork(function() local tk2 = ltime() - log_debug("node_status2 : %s, %s, %s", tk2 - tk1, tk2, tk1) + log_debug("node_status2 : {}, {}, {}", tk2 - tk1, tk2, tk1) local ok, status, res = http_client:call_get("http://127.0.0.1:8888/node_status2", data) - log_debug("node_status2 : %s, %s, %s, %s", ltime() - tk2, ok, status, res) + log_debug("node_status2 : {}, {}, {}, {}", ltime() - tk2, ok, status, res) end) thread_mgr:fork(function() local tk2 = ltime() - log_debug("node_status3 : %s, %s, %s", tk2 - tk1, tk2, tk1) + log_debug("node_status3 : {}, {}, {}", tk2 - tk1, tk2, tk1) local ok, status, res = http_client:call_put("http://127.0.0.1:8888/node_status3", data) - log_debug("node_status3 : %s, %s, %s, %s", ltime() - tk2, ok, status, res) + log_debug("node_status3 : {}, {}, {}, {}", ltime() - tk2, ok, status, res) end) thread_mgr:fork(function() local tk2 = ltime() - log_debug("node_status4 : %s, %s, %s", tk2 - tk1, tk2, tk1) + log_debug("node_status4 : {}, {}, {}", tk2 - tk1, tk2, tk1) local ok, status, res = http_client:call_del("http://127.0.0.1:8888/node_status4", data) - log_debug("node_status4 : %s, %s, %s, %s", ltime() - tk2, ok, status, res) + log_debug("node_status4 : {}, {}, {}, {}", ltime() - tk2, ok, status, res) end) end end diff --git a/server/test/influx_test.lua b/server/test/influx_test.lua index 4c545594..5a146086 100644 --- a/server/test/influx_test.lua +++ b/server/test/influx_test.lua @@ -15,17 +15,17 @@ local influx = Influx(ip, port, org, bucket, token) timer_mgr:once(2000, function() local _, orgs = influx:find_org() - log_debug("find_org: %s", orgs) + log_debug("find_org: {}", orgs) local _, bucket1 = influx:create_bucket("testdb") - log_debug("create_bucket: %s", bucket1) + log_debug("create_bucket: {}", bucket1) local _, bucket2 = influx:find_bucket("testdb") - log_debug("find_bucket: %s", bucket2) + log_debug("find_bucket: {}", bucket2) local res = influx:delete_bucket_by_id(bucket2.id) - log_debug("delete_bucket_by_id: %s", res) + log_debug("delete_bucket_by_id: {}", res) local _, bucket3 = influx:create_bucket("testdb") - log_debug("create_bucket: %s", bucket3) + log_debug("create_bucket: {}", bucket3) local ok1, wres = influx:write("test_tab", {type = 3}, {id = 5, name = "3333", exp = 666}) - log_debug("write: ok1: %s, res:%s", ok1, wres) + log_debug("write: ok1: {}, res:{}", ok1, wres) local ok2, qres = influx:query([[from(bucket: "testdb") |> range(start: -12h) |> filter(fn: (r) => r["_measurement"] == "test_tab") @@ -33,5 +33,5 @@ timer_mgr:once(2000, function() |> filter(fn: (r) => r["type"] == "3") |> aggregateWindow(every: 1h, fn: mean, createEmpty: false) |> yield(name: "mean")]]) - log_debug("query: ok2: %s, res:%s", ok2, qres) + log_debug("query: ok2: {}, res:{}", ok2, qres) end) diff --git a/server/test/json_test.lua b/server/test/json_test.lua index 1d444dd2..3c03f436 100644 --- a/server/test/json_test.lua +++ b/server/test/json_test.lua @@ -45,43 +45,43 @@ local vv = { detail = protobuf_mgr:encode_byname("ncmd_cs.login_account_login_res", value) } -log_debug("%s, %s", #vv.detail, vv.detail) +log_debug("{}, {}", #vv.detail, vv.detail) local c = jpretty(vv) -log_debug("json_encode: %s", c) +log_debug("json_encode: {}", c) local d = jdecode(c) -log_debug("json_decode: %s", d) +log_debug("json_decode: {}", d) local dd = protobuf_mgr:decode_byname("ncmd_cs.login_account_login_res", d.detail) -log_debug("decode_byname: %s", dd) +log_debug("decode_byname: {}", dd) local a = jencode(test, 1) -log_debug("json_encode: %s", a) +log_debug("json_encode: {}", a) local b = jdecode(a, 1) log_debug(type(b.tid), b.tid) log_debug(type(b.player_id), b.player_id) -log_debug("json_decode: %s", b) +log_debug("json_decode: {}", b) -log_debug("%s", b.c) -log_debug("%s, %s", type(b.tid), b.tid) -log_debug("%s, %s", type(b.player_id), b.player_id) +log_debug("{}", b.c) +log_debug("{}, {}", type(b.tid), b.tid) +log_debug("{}, {}", type(b.player_id), b.player_id) for k, v in pairs(b.c) do - log_debug("c %s, %s", type(k), k) - log_debug("c %s, %s", type(v), v) + log_debug("c {}, {}", type(k), k) + log_debug("c {}, {}", type(v), v) end local x1 = jencode(test) -log_debug("tt1:%s%s", x1, #x1) +log_debug("tt1:{}", x1, #x1) local aaa = lencode(test) local bbb = ldecode(aaa) -log_debug("tt22:%s%s", bbb, #aaa) +log_debug("tt22:{}", bbb, #aaa) local aaa1 = bencode(test) local bbb1 = bdecode(aaa1) -log_debug("tt23:%s%s", bbb1, #aaa1) +log_debug("tt23:{}", bbb1, #aaa1) local tt1 = ltime() for i = 1, 100000 do @@ -112,7 +112,7 @@ local tt7 = ltime() for i = 1, 100000 do local x = bdecode(aaa1) if i == 10000 then - log_debug("tt24:%s", x) + log_debug("tt24:{}", x) end end local tt8 = ltime() @@ -121,5 +121,5 @@ for i = 1, 100000 do end local tt9 = ltime() -log_debug("tt1:%s, tt2:%s, tt3:%s, tt4:%s", tt2 - tt1, tt3 - tt2, tt4 - tt3, tt5 - tt4) -log_debug("tt5:%s, tt6:%s, tt7:%s, tt8:%s", tt6 - tt5, tt7 - tt6, tt8 - tt7, tt9 - tt8) +log_debug("tt1:{}, tt2:{}, tt3:{}, tt4:{}", tt2 - tt1, tt3 - tt2, tt4 - tt3, tt5 - tt4) +log_debug("tt5:{}, tt6:{}, tt7:{}, tt8:{}", tt6 - tt5, tt7 - tt6, tt8 - tt7, tt9 - tt8) diff --git a/server/test/lock_test.lua b/server/test/lock_test.lua index 2b073ab8..8ab4083a 100644 --- a/server/test/lock_test.lua +++ b/server/test/lock_test.lua @@ -7,30 +7,30 @@ local thread_mgr = quanta.get("thread_mgr") local function test_a(index) local _ = thread_mgr:lock("sync_lock_test", true) thread_mgr:sleep(10) - log_debug("test_a:%s", index) + log_debug("test_a:{}", index) end local function test_b(index) local _ = thread_mgr:lock("sync_lock_test", true) thread_mgr:sleep(10) test_a(index) - log_debug("test_b:%s", index) + log_debug("test_b:{}", index) end local function test_c(index) local _ = thread_mgr:lock("sync_lock_test", true) thread_mgr:sleep(10) test_b(index) - log_debug("test_c:%s", index) + log_debug("test_c:{}", index) end local function test_loop_lock(index) - log_debug("lock:%s", index) + log_debug("lock:{}", index) local _ = thread_mgr:lock("test_loop", true) if 1 == index then thread_mgr:sleep(10) end - log_debug("unlock:%s", index) + log_debug("unlock:{}", index) end local function test1() diff --git a/server/test/mongo_test.lua b/server/test/mongo_test.lua index 9991225d..20fcd273 100644 --- a/server/test/mongo_test.lua +++ b/server/test/mongo_test.lua @@ -12,36 +12,36 @@ local MAIN_DBID = environ.number("QUANTA_DB_MAIN_ID") timer_mgr:once(2000, function() local code, count = mongo_mgr:count(MAIN_DBID, "test_mongo_1", {pid = 123456}) - log_debug("db count code: %s, count = %s", code, count) + log_debug("db count code: {}, count = {}", code, count) local icode, ierr = mongo_mgr:insert(MAIN_DBID, primary_id, "test_mongo_1", {pid = 123456, data = {a =1, b=2}}) - log_debug("db insert code: %s, err = %s", icode, ierr) + log_debug("db insert code: {}, err = {}", icode, ierr) icode, ierr = mongo_mgr:insert(MAIN_DBID, primary_id, "test_mongo_1", {pid = 123457, data = {a =1, b=2}}) - log_debug("db insert code: %s, err = %s", icode, ierr) + log_debug("db insert code: {}, err = {}", icode, ierr) local fcode, res = mongo_mgr:find(MAIN_DBID, primary_id, "test_mongo_1", {}, {_id = 0}) - log_debug("db find code: %s, res = %s", fcode, res) + log_debug("db find code: {}, res = {}", fcode, res) local f1code, f1res = mongo_mgr:find_one(MAIN_DBID, primary_id, "test_mongo_1", {pid = 123456}, {_id = 0}) - log_debug("db find code: %s, res = %s", f1code, f1res) + log_debug("db find code: {}, res = {}", f1code, f1res) local ucode, uerr = mongo_mgr:update(MAIN_DBID, primary_id, "test_mongo_1", {pid = 123458, data = {a =1, b=4}}, {pid = 123457}) - log_debug("db update code: %s, err = %s", ucode, uerr) + log_debug("db update code: {}, err = {}", ucode, uerr) code, count = mongo_mgr:count(MAIN_DBID, "test_mongo_1", {pid = 123456}) - log_debug("db count code: %s, count = %s", code, count) + log_debug("db count code: {}, count = {}", code, count) local ecode, eres = mongo_mgr:delete(MAIN_DBID, primary_id, "test_mongo_1", {pid = 123456}) - log_debug("db delete code: %s, count = %s", ecode, eres) + log_debug("db delete code: {}, count = {}", ecode, eres) code, count = mongo_mgr:count(MAIN_DBID, "test_mongo_1", {pid = 123456}) - log_debug("db count code: %s, count = %s", code, count) + log_debug("db count code: {}, count = {}", code, count) icode, ierr = mongo_mgr:create_indexes(MAIN_DBID, "test_mongo_2", {{key={userid=1},name="test_uid", unique = true}}) - log_debug("db create_indexes code: %s, err = %s", icode, ierr) + log_debug("db create_indexes code: {}, err = {}", icode, ierr) icode, ierr = mongo_mgr:execute(MAIN_DBID, primary_id, "listIndexes", "test_mongo_2") - log_debug("db listIndexes code: %s, err = %s", icode, ierr) + log_debug("db listIndexes code: {}, err = {}", icode, ierr) icode, ierr = mongo_mgr:drop_indexes(MAIN_DBID, "test_mongo_2", "test_uid") - log_debug("db drop_indexes code: %s, err = %s", icode, ierr) + log_debug("db drop_indexes code: {}, err = {}", icode, ierr) --[[ fcode, res = mongo_mgr:find(MAIN_DBID, "test_mongo_1", {}, {_id = 0}, {pid = 1}) for _, v in pairs(res) do - log_debug("db find sort code: %s, v = %s", fcode, v) + log_debug("db find sort code: {}, v = {}", fcode, v) end local acode, id = mongo_mgr:get_autoinc_id(MAIN_DBID, "splayer") - log_debug("db autoinc code: %s, id = %s", acode, id) + log_debug("db autoinc code: {}, id = {}", acode, id) ]] end) diff --git a/server/test/mysql_test.lua b/server/test/mysql_test.lua index 51cdcee4..bb4e387b 100644 --- a/server/test/mysql_test.lua +++ b/server/test/mysql_test.lua @@ -11,27 +11,27 @@ local MAIN_DBID = environ.number("QUANTA_DB_MAIN_ID") timer_mgr:once(3000, function() log_debug("mysql db start test!") local code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "drop table test_mysql") - log_debug("db drop table code: %s, res = %s", code, res_oe) + log_debug("db drop table code: {}, res = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "create table if not exists test_mysql (id int auto_increment, pid int, value int, primary key (id))") - log_debug("db create table code: %s, res = %s", code, res_oe) + log_debug("db create table code: {}, res = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "insert into test_mysql (pid, value) values (123457, 40)") - log_debug("db insert code: %s, res_oe = %s", code, res_oe) + log_debug("db insert code: {}, res_oe = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "insert into test_mysql (pid, value) values (123456, 40)") - log_debug("db insert code: %s, res_oe = %s", code, res_oe) + log_debug("db insert code: {}, res_oe = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "select count(*) as count from test_mysql where pid=123457") - log_debug("db select code: %s, count = %s", code, res_oe) + log_debug("db select code: {}, count = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "select * from test_mysql where pid = 123456") - log_debug("db select code: %s, res_oe = %s", code, res_oe) + log_debug("db select code: {}, res_oe = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "update test_mysql set pid = 123454, value = 20 where pid = 123456 limit 1") - log_debug("db update code: %s, err = %s", code, res_oe) + log_debug("db update code: {}, err = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "select * from test_mysql") - log_debug("db select code: %s, res_oe = %s", code, res_oe) + log_debug("db select code: {}, res_oe = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "delete from test_mysql where pid = 123457") - log_debug("db delete code: %s, err = %s", code, res_oe) + log_debug("db delete code: {}, err = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "replace into test_mysql (id, pid, value) values (1, 123457, 40)") - log_debug("db replace code: %s, count = %s", code, res_oe) + log_debug("db replace code: {}, count = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "select * from test_mysql") - log_debug("db select code: %s, res_oe = %s", code, res_oe) + log_debug("db select code: {}, res_oe = {}", code, res_oe) code, res_oe = mysql_mgr:query(MAIN_DBID, MAIN_DBID, "select count(*) as count from test_mysql where pid=123454") - log_debug("db count code: %s, count = %s", code, res_oe) + log_debug("db count code: {}, count = {}", code, res_oe) end) \ No newline at end of file diff --git a/server/test/nacos_test.lua b/server/test/nacos_test.lua index 075167c9..a89a1066 100644 --- a/server/test/nacos_test.lua +++ b/server/test/nacos_test.lua @@ -11,55 +11,55 @@ local thread_mgr = quanta.get("thread_mgr") thread_mgr:fork(function() local cres = nacos:create_namespace("1234567", "quanta", "test create_namespace") - log_debug("create_namespace: %s", cres) + log_debug("create_namespace: {}", cres) local nss = nacos:query_namespaces() - log_debug("query_namespaces: %s", nss) + log_debug("query_namespaces: {}", nss) --[[ local mres = nacos:modify_namespace("1234567", "quanta", "test create_namespace2") - log_debug("modify_namespace: %s", mres) + log_debug("modify_namespace: {}", mres) local nss3 = nacos:query_namespaces() - log_debug("query_namespaces3: %s", nss3) + log_debug("query_namespaces3: {}", nss3) local dres = nacos:del_namespace("1234567") - log_debug("del_namespace: %s", dres) + log_debug("del_namespace: {}", dres) local nss4 = nacos:query_namespaces() - log_debug("query_namespaces4: %s", nss4) + log_debug("query_namespaces4: {}", nss4) ]] local value = lhex_encode(lrandomkey()) local pfres = nacos:modify_config("test2", value) - log_debug("modify_config: test-> %s, success-> %s", value, pfres) + log_debug("modify_config: test-> {}, success-> {}", value, pfres) local cfres = nacos:get_config("test2") - log_debug("get_config: test-> %s", cfres) + log_debug("get_config: test-> {}", cfres) local dfres = nacos:del_config("test2") - log_debug("del_config: test-> %s", dfres) + log_debug("del_config: test-> {}", dfres) local sres = nacos:create_service("lobby", "quanta") - log_debug("create_service: lobby-> %s", sres) + log_debug("create_service: lobby-> {}", sres) local sres2 = nacos:create_service("lobby2", "quanta") - log_debug("create_service: lobby2-> %s", sres2) + log_debug("create_service: lobby2-> {}", sres2) local mres = nacos:modify_service("lobby2", "quanta") - log_debug("modify_service: lobby-> %s", mres) + log_debug("modify_service: lobby-> {}", mres) local qres = nacos:query_service("lobby", "quanta") - log_debug("query_service: lobby-> %s", qres) + log_debug("query_service: lobby-> {}", qres) local qlres = nacos:query_services(1, 20, "quanta") - log_debug("query_services: quanta-> %s", qlres) + log_debug("query_services: quanta-> {}", qlres) local dres = nacos:del_service("lobby2", "quanta") - log_debug("del_service: quanta-> %s", dres) + log_debug("del_service: quanta-> {}", dres) local rres = nacos:regi_instance("lobby2", quanta.host, 1, "quanta") - log_debug("regi_instance: lobby2-> %s", rres) + log_debug("regi_instance: lobby2-> {}", rres) local ilres = nacos:query_instances("lobby2", "quanta") - log_debug("query_instances: lobby2-> %s", ilres) + log_debug("query_instances: lobby2-> {}", ilres) local ires = nacos:query_instance("lobby2", quanta.host, 1, "quanta") - log_debug("query_instance: lobby2-> %s", ires) + log_debug("query_instance: lobby2-> {}", ires) local dires = nacos:del_instance("lobby2", quanta.host, 1, "quanta") - log_debug("del_instance: lobby2-> %s", dires) + log_debug("del_instance: lobby2-> {}", dires) nacos:listen_config("test", nil, nil, function(data_id, group, md5, cvalue) - log_debug("listen_config: test-> %s", cvalue) + log_debug("listen_config: test-> {}", cvalue) end) end) @@ -67,11 +67,11 @@ timer_mgr:loop(3000, function() --[[ local value = lhex_encode(lrandomkey()) local pfres = nacos:modify_config("test", value) - log_debug("modify_config: test-> %s, success-> %s", value, pfres) + log_debug("modify_config: test-> {}, success-> {}", value, pfres) ]] local ilres = nacos:query_instances("lobby2", "quanta") - log_debug("query_instances: lobby2-> %s", ilres) + log_debug("query_instances: lobby2-> {}", ilres) --local bres = nacos:sent_beat("lobby2", 2, "quanta") - --log_debug("sent_beat: lobby-> %s", bres) + --log_debug("sent_beat: lobby-> {}", bres) end) diff --git a/server/test/pack_test.lua b/server/test/pack_test.lua index aba7b5bb..c4ea9981 100644 --- a/server/test/pack_test.lua +++ b/server/test/pack_test.lua @@ -23,7 +23,7 @@ function PackTest:on_service_ready(quanta_id) args[#args + 1] = ss end local _, send_len = router.socket.call_target(quanta_id, "test_log", 0, "arg_1", args, "arg_3") - log_info("[PackTest][on_service_ready] send size : %s", send_len) + log_info("[PackTest][on_service_ready] send size : {}", send_len) end end diff --git a/server/test/protobuf_test.lua b/server/test/protobuf_test.lua index 068c8bfe..fa9a23dc 100644 --- a/server/test/protobuf_test.lua +++ b/server/test/protobuf_test.lua @@ -13,12 +13,12 @@ local pb_str1 = protobuf_mgr:encode("NID_HEARTBEAT_REQ", pb_data) local data1 = protobuf_mgr:decode("NID_HEARTBEAT_REQ", pb_str1) local pb_str2 = protobuf_mgr:encode(NCmdId.NID_HEARTBEAT_REQ, pb_data) local data2 = protobuf_mgr:decode(NCmdId.NID_HEARTBEAT_REQ, pb_str2) -log_debug("name test1:%s", data1) -log_debug("name test2:%s", data2) +log_debug("name test1:{}", data1) +log_debug("name test2:{}", data2) local ppb_data = {master=1001014162,elems={[107216333761938434]={proto_id=0}},part_sync=true} local ppb_str = protobuf_mgr:encode_byname("ncmd_cs.building_building_ntf", ppb_data) local pdata = protobuf_mgr:decode_byname("ncmd_cs.building_building_ntf", ppb_str) -log_debug("pb test:%s", #ppb_str) -log_debug("pb test:%s", pdata) +log_debug("pb test:{}", #ppb_str) +log_debug("pb test:{}", pdata) diff --git a/server/test/redis_cluster.lua b/server/test/redis_cluster.lua index 5b0eb750..aff3ca5f 100644 --- a/server/test/redis_cluster.lua +++ b/server/test/redis_cluster.lua @@ -10,13 +10,13 @@ local MAIN_DBID = environ.number("QUANTA_DB_MAIN_ID") timer_mgr:once(2000, function() local code, res = redis_mgr:execute(MAIN_DBID, "cluster", "nodes") - log_debug("db get code: %s, res(%s) = %s", code, type(res), res) + log_debug("db get code: {}, res({}) = {}", code, type(res), res) code, res = redis_mgr:execute(MAIN_DBID, "cluster", "slots") - log_debug("db get code: %s, res(%s) = %s", code, type(res), res) + log_debug("db get code: {}, res({}) = {}", code, type(res), res) code, res = redis_mgr:execute(MAIN_DBID, "set", "aaa", {abc = 3, ddd = 4}) - log_debug("db set code: %s, res = %s", code, res) + log_debug("db set code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "get", "aaa") - log_debug("db get code: %s, res = %s", code, res) + log_debug("db get code: {}, res = {}", code, res) local code1, res1, res2 = redis_mgr:execute(MAIN_DBID, "scan", "0") - log_debug("db scan code: %s, res = %s, res2=%s", code1, res1, res2) + log_debug("db scan code: {}, res = {}, res2={}", code1, res1, res2) end) \ No newline at end of file diff --git a/server/test/redis_test.lua b/server/test/redis_test.lua index 8c55de03..5f277d86 100644 --- a/server/test/redis_test.lua +++ b/server/test/redis_test.lua @@ -10,71 +10,71 @@ local MAIN_DBID = environ.number("QUANTA_DB_MAIN_ID") timer_mgr:once(2000, function() local code, res = redis_mgr:execute(MAIN_DBID, "get", "aaa") - log_debug("db get code: %s, res = %s", code, res) + log_debug("db get code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "set", "aaa", {abc = 3, ddd = 4}) - log_debug("db set code: %s, res = %s", code, res) + log_debug("db set code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "get", "aaa") - log_debug("db get code: %s, res = %s", code, res) + log_debug("db get code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "get", "aaa") - log_debug("db get code: %s, res = %s", code, res) + log_debug("db get code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "hget", "bb", "k1") - log_debug("db hget code: %s, res = %s", code, res) + log_debug("db hget code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "hset", "bb", "k1", 123) - log_debug("db hset code: %s, res = %s", code, res) + log_debug("db hset code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "hmset", "bb", "k2", 234, "k3", 345) - log_debug("db hmset code: %s, res = %s", code, res) + log_debug("db hmset code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "hget", "bb", "k1") - log_debug("db hget code: %s, res = %s", code, res) + log_debug("db hget code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "hdel", "bb", "k1") - log_debug("db hdel code: %s, res = %s", code, res) + log_debug("db hdel code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "hmget", "bb", "k1", "k2", "k3") - log_debug("db hget code: %s, res = %s", code, res) + log_debug("db hget code: {}, res = {}", code, res) local scode, cur, vals = redis_mgr:execute(MAIN_DBID, "hscan", "bb", 0) - log_debug("db hscan code: %s, cur = %s, vals=%s", scode, cur, vals) + log_debug("db hscan code: {}, cur = {}, vals={}", scode, cur, vals) code, res = redis_mgr:execute(MAIN_DBID, "sadd", "sset", "k1", "k2", "k3") - log_debug("db sadd code: %s, res = %s", code, res) + log_debug("db sadd code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "scard", "sset") - log_debug("db scard code: %s, res = %s", code, res) + log_debug("db scard code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "sismember", "sset", "one") - log_debug("db sismember code: %s, res = %s", code, res) + log_debug("db sismember code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "sismember", "sset", "k2") - log_debug("db sismember code: %s, res = %s", code, res) + log_debug("db sismember code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "smembers", "sset") - log_debug("db smembers code: %s, res = %s", code, res) + log_debug("db smembers code: {}, res = {}", code, res) scode, cur, vals = redis_mgr:execute(MAIN_DBID, "sscan", "sset", 0) - log_debug("db sscan code: %s, cur = %s, vals=%s", scode, cur, vals) + log_debug("db sscan code: {}, cur = {}, vals={}", scode, cur, vals) code, res = redis_mgr:execute(MAIN_DBID, "spop", "sset") - log_debug("db spop code: %s, res = %s", code, res) + log_debug("db spop code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zadd", "zset1",1,"one") - log_debug("db zadd code: %s, res = %s", code, res) + log_debug("db zadd code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zadd", "zset1",1,"uno") - log_debug("db zadd code: %s, res = %s", code, res) + log_debug("db zadd code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zadd", "zset1",2,"two") - log_debug("db zadd code: %s, res = %s", code, res) + log_debug("db zadd code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zadd", "zset1",3,"three") - log_debug("db zadd code: %s, res = %s", code, res) + log_debug("db zadd code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zcard", "zset1") - log_debug("db zcard code: %s, res = %s", code, res) + log_debug("db zcard code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zcount", "zset1",1,2) - log_debug("db zcount code: %s, res = %s", code, res) + log_debug("db zcount code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zrange", "zset1",0,2) - log_debug("db zrange code: %s, res = %s", code, res) + log_debug("db zrange code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zrank", "zset1","two") - log_debug("db zrank code: %s, res = %s", code, res) + log_debug("db zrank code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zscore", "zset1","two") - log_debug("db zscore code: %s, res = %s", code, res) + log_debug("db zscore code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zrange", "zset1", 0, 2, "WITHSCORES") - log_debug("db zrange withscores code: %s, res = %s", code, res) + log_debug("db zrange withscores code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "zrangebyscore", "zset1", 0, 2) - log_debug("db zrange zrangebyscore code: %s, res = %s", code, res) + log_debug("db zrange zrangebyscore code: {}, res = {}", code, res) scode, cur, vals = redis_mgr:execute(MAIN_DBID, "zscan", "zset1", 0) - log_debug("db zscan code: %s, cur = %s, vals=%s", scode, cur, vals) + log_debug("db zscan code: {}, cur = {}, vals={}", scode, cur, vals) --[[ --code, res = redis_mgr:execute(MAIN_DBID, "subscribe", "test") - --log_debug("db subscribe code: %s, res = %s", code, res) + --log_debug("db subscribe code: {}, res = {}", code, res) code, res = redis_mgr:execute(MAIN_DBID, "publish", "test", 123) - log_debug("db publish code: %s, res = %s", code, res) - log_debug("db spop code: %s, res = %s", code, res) + log_debug("db publish code: {}, res = {}", code, res) + log_debug("db spop code: {}, res = {}", code, res) ]] end) \ No newline at end of file diff --git a/server/test/router_test.lua b/server/test/router_test.lua index 9a00918d..24bd1d2b 100644 --- a/server/test/router_test.lua +++ b/server/test/router_test.lua @@ -11,16 +11,16 @@ function RouterTest:__init() timer_mgr:once(4000, function() local ok, code, res = router_mgr:call_mongo_random("rpc_mongo_find", "default", "test_mongo_1", {}, {_id = 0}) - log_debug("db find ok:%s, code: %s, res = %s", ok, code, res) + log_debug("db find ok:{}, code: {}, res = {}", ok, code, res) end) end function RouterTest:on_service_ready(quanta_id) - log_debug("on_service_ready quanta_id :%s", quanta_id) + log_debug("on_service_ready quanta_id :{}", quanta_id) end function RouterTest:on_service_close(quanta_id) - log_debug("on_service_close quanta_id :%s", quanta_id) + log_debug("on_service_close quanta_id :{}", quanta_id) end quanta.router_test = RouterTest() diff --git a/server/test/rpc_test.lua b/server/test/rpc_test.lua index eee7319c..44ef1b70 100644 --- a/server/test/rpc_test.lua +++ b/server/test/rpc_test.lua @@ -25,16 +25,16 @@ function RpcTest:setup() for n = 1, 200 do local ok, rn, rdata = router_mgr:call_target(quanta.id, "on_echo", n, data) if ok then - log_debug("%s res: %s", rn, #rdata) + log_debug("{} res: {}", rn, #rdata) else - log_debug("%s err: %s", n, rn) + log_debug("{} err: {}", n, rn) end end end) end function RpcTest:on_echo(n, data) - log_debug("%s req: %s", n, #data) + log_debug("{} req: {}", n, #data) return n, data end diff --git a/server/worker/wtest.lua b/server/worker/wtest.lua index 7c7cc510..f47fa4ff 100644 --- a/server/worker/wtest.lua +++ b/server/worker/wtest.lua @@ -13,7 +13,7 @@ function WorkerTest:__init() end function WorkerTest:test_worker_rpc(a, b, c, d) - log_debug("[WorkerTest][test_worker_rpc] %s, %s, %s, %s", a, b, c, d) + log_debug("[WorkerTest][test_worker_rpc] {}, {}, {}, {}", a, b, c, d) return a + b, c + d end @@ -23,9 +23,9 @@ quanta.startup(function() timer_mgr:loop(2000, function() local ok, res1, res2 = quanta.call_master("test_master_rpc", 1, 2, 3, 4) if not ok then - log_err("[worker][call_master] test_master_rpc failed: %s", res1) + log_err("[worker][call_master] test_master_rpc failed: {}", res1) return end - log_debug("[worker][call_master] test_master_rpc success: %s, %s", res1, res2) + log_debug("[worker][call_master] test_master_rpc success: {}, {}", res1, res2) end) end)