1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Improve readability and infos in verbose log (#13828)

This commit is contained in:
sfan5 2023-09-22 18:41:10 +02:00 committed by GitHub
parent 5949172735
commit c3114132d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 26 additions and 51 deletions

View file

@ -1317,9 +1317,7 @@ void Client::sendChatMessage(const std::wstring &message)
m_chat_message_allowance -= 1.0f; m_chat_message_allowance -= 1.0f;
NetworkPacket pkt(TOSERVER_CHAT_MESSAGE, 2 + message.size() * sizeof(u16)); NetworkPacket pkt(TOSERVER_CHAT_MESSAGE, 2 + message.size() * sizeof(u16));
pkt << message; pkt << message;
Send(&pkt); Send(&pkt);
} else if (m_out_chat_queue.size() < (u16) max_queue_size || max_queue_size < 0) { } else if (m_out_chat_queue.size() < (u16) max_queue_size || max_queue_size < 0) {
m_out_chat_queue.push(message); m_out_chat_queue.push(message);
@ -1701,8 +1699,11 @@ void Client::typeChatMessage(const std::wstring &message)
if (message.empty()) if (message.empty())
return; return;
auto message_utf8 = wide_to_utf8(message);
infostream << "Typed chat message: \"" << message_utf8 << "\"" << std::endl;
// If message was consumed by script API, don't send it to server // If message was consumed by script API, don't send it to server
if (m_mods_loaded && m_script->on_sending_message(wide_to_utf8(message))) if (m_mods_loaded && m_script->on_sending_message(message_utf8))
return; return;
// Send to others // Send to others

View file

@ -357,7 +357,6 @@ bool GenericCAO::collideWithObjects() const
void GenericCAO::initialize(const std::string &data) void GenericCAO::initialize(const std::string &data)
{ {
infostream<<"GenericCAO: Got init data"<<std::endl;
processInitData(data); processInitData(data);
m_enable_shaders = g_settings->getBool("enable_shaders"); m_enable_shaders = g_settings->getBool("enable_shaders");
@ -393,8 +392,7 @@ void GenericCAO::processInitData(const std::string &data)
} }
const u8 num_messages = readU8(is); const u8 num_messages = readU8(is);
for (u8 i = 0; i < num_messages; i++) {
for (int i = 0; i < num_messages; i++) {
std::string message = deSerializeString32(is); std::string message = deSerializeString32(is);
processMessage(message); processMessage(message);
} }
@ -1704,8 +1702,6 @@ void GenericCAO::processMessage(const std::string &data)
if (expire_visuals) { if (expire_visuals) {
expireVisuals(); expireVisuals();
} else { } else {
infostream << "GenericCAO: properties updated but expiring visuals"
<< " not necessary" << std::endl;
if (textures_changed) { if (textures_changed) {
// don't update while punch texture modifier is active // don't update while punch texture modifier is active
if (m_reset_textures_timer < 0) if (m_reset_textures_timer < 0)

View file

@ -195,16 +195,7 @@ void RenderingEngine::cleanupMeshCache()
bool RenderingEngine::setupTopLevelWindow() bool RenderingEngine::setupTopLevelWindow()
{ {
// FIXME: It would make more sense for there to be a switch of some return setWindowIcon();
// sort here that would call the correct toplevel setup methods for
// the environment Minetest is running in.
/* Setting general properties for the top level window */
verbosestream << "Client: Configuring general top level window properties"
<< std::endl;
bool result = setWindowIcon();
return result;
} }
bool RenderingEngine::setWindowIcon() bool RenderingEngine::setWindowIcon()

View file

@ -488,8 +488,6 @@ u32 ShaderSource::getShader(const std::string &name,
u32 ShaderSource::getShaderIdDirect(const std::string &name, u32 ShaderSource::getShaderIdDirect(const std::string &name,
MaterialType material_type, NodeDrawType drawtype) MaterialType material_type, NodeDrawType drawtype)
{ {
//infostream<<"getShaderIdDirect(): name=\""<<name<<"\""<<std::endl;
// Empty name means shader 0 // Empty name means shader 0
if (name.empty()) { if (name.empty()) {
infostream<<"getShaderIdDirect(): name is empty"<<std::endl; infostream<<"getShaderIdDirect(): name is empty"<<std::endl;

View file

@ -412,7 +412,9 @@ queue_full_break:
if (d > full_d_max) { if (d > full_d_max) {
new_nearest_unsent_d = 0; new_nearest_unsent_d = 0;
m_nothing_to_send_pause_timer = 2.0f; m_nothing_to_send_pause_timer = 2.0f;
infostream << "Server: Player " << m_name << ", RemoteClient " << peer_id << ": full map send completed after " << m_map_send_completion_timer << "s, restarting" << std::endl; infostream << "Server: Player " << m_name << ", peer_id=" << peer_id
<< ": full map send completed after " << m_map_send_completion_timer
<< "s, restarting" << std::endl;
m_map_send_completion_timer = 0.0f; m_map_send_completion_timer = 0.0f;
} else { } else {
if (nearest_sent_d != -1) if (nearest_sent_d != -1)

View file

@ -353,14 +353,14 @@ public:
if (!inventory_overlay.empty()) if (!inventory_overlay.empty())
cache_key += ":" + inventory_overlay; cache_key += ":" + inventory_overlay;
infostream << "Lazily creating item texture and mesh for \""
<< cache_key << "\""<<std::endl;
// Skip if already in cache // Skip if already in cache
auto it = m_clientcached.find(cache_key); auto it = m_clientcached.find(cache_key);
if (it != m_clientcached.end()) if (it != m_clientcached.end())
return it->second.get(); return it->second.get();
infostream << "Lazily creating item texture and mesh for \""
<< cache_key << "\"" << std::endl;
ITextureSource *tsrc = client->getTextureSource(); ITextureSource *tsrc = client->getTextureSource();
// Create new ClientCached // Create new ClientCached

View file

@ -713,8 +713,8 @@ static void uninit_common()
static void startup_message() static void startup_message()
{ {
infostream << PROJECT_NAME << " " << _("with") infostream << PROJECT_NAME_C << " " << g_version_hash
<< " SER_FMT_VER_HIGHEST_READ=" << "\nwith SER_FMT_VER_HIGHEST_READ="
<< (int)SER_FMT_VER_HIGHEST_READ << ", " << (int)SER_FMT_VER_HIGHEST_READ << ", "
<< g_build_info << std::endl; << g_build_info << std::endl;
} }

View file

@ -91,14 +91,15 @@ bool MapBlock::onObjectsActivation()
if (m_static_objects.getAllStored().empty()) if (m_static_objects.getAllStored().empty())
return false; return false;
const auto count = m_static_objects.getStoredSize();
verbosestream << "MapBlock::onObjectsActivation(): " verbosestream << "MapBlock::onObjectsActivation(): "
<< "activating objects of block " << getPos() << " (" << "activating " << count << "objects in block " << getPos()
<< m_static_objects.getStoredSize() << " objects)" << std::endl; << std::endl;
if (m_static_objects.getStoredSize() > g_settings->getU16("max_objects_per_block")) { if (count > g_settings->getU16("max_objects_per_block")) {
errorstream << "suspiciously large amount of objects detected: " errorstream << "suspiciously large amount of objects detected: "
<< m_static_objects.getStoredSize() << " in " << count << " in " << getPos() << "; removing all of them."
<< getPos() << "; removing all of them." << std::endl; << std::endl;
// Clear stored list // Clear stored list
m_static_objects.clearStored(); m_static_objects.clearStored();
raiseModified(MOD_STATE_WRITE_NEEDED, MOD_REASON_TOO_MANY_OBJECTS); raiseModified(MOD_STATE_WRITE_NEEDED, MOD_REASON_TOO_MANY_OBJECTS);

View file

@ -29,9 +29,6 @@ bool ScriptApiEntity::luaentity_Add(u16 id, const char *name)
{ {
SCRIPTAPI_PRECHECKHEADER SCRIPTAPI_PRECHECKHEADER
verbosestream<<"scriptapi_luaentity_add: id="<<id<<" name=\""
<<name<<"\""<<std::endl;
// Get core.registered_entities[name] // Get core.registered_entities[name]
lua_getglobal(L, "core"); lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_entities"); lua_getfield(L, -1, "registered_entities");
@ -78,8 +75,6 @@ void ScriptApiEntity::luaentity_Activate(u16 id,
{ {
SCRIPTAPI_PRECHECKHEADER SCRIPTAPI_PRECHECKHEADER
verbosestream << "scriptapi_luaentity_activate: id=" << id << std::endl;
int error_handler = PUSH_ERROR_HANDLER(L); int error_handler = PUSH_ERROR_HANDLER(L);
// Get core.luaentities[id] // Get core.luaentities[id]
@ -106,8 +101,6 @@ void ScriptApiEntity::luaentity_Deactivate(u16 id, bool removal)
{ {
SCRIPTAPI_PRECHECKHEADER SCRIPTAPI_PRECHECKHEADER
verbosestream << "scriptapi_luaentity_deactivate: id=" << id << std::endl;
int error_handler = PUSH_ERROR_HANDLER(L); int error_handler = PUSH_ERROR_HANDLER(L);
// Get the entity // Get the entity
@ -132,8 +125,6 @@ void ScriptApiEntity::luaentity_Remove(u16 id)
{ {
SCRIPTAPI_PRECHECKHEADER SCRIPTAPI_PRECHECKHEADER
verbosestream << "scriptapi_luaentity_rm: id=" << id << std::endl;
// Get core.luaentities table // Get core.luaentities table
lua_getglobal(L, "core"); lua_getglobal(L, "core");
lua_getfield(L, -1, "luaentities"); lua_getfield(L, -1, "luaentities");
@ -152,8 +143,6 @@ std::string ScriptApiEntity::luaentity_GetStaticdata(u16 id)
{ {
SCRIPTAPI_PRECHECKHEADER SCRIPTAPI_PRECHECKHEADER
//infostream<<"scriptapi_luaentity_get_staticdata: id="<<id<<std::endl;
int error_handler = PUSH_ERROR_HANDLER(L); int error_handler = PUSH_ERROR_HANDLER(L);
// Get core.luaentities[id] // Get core.luaentities[id]
@ -217,8 +206,6 @@ void ScriptApiEntity::luaentity_GetProperties(u16 id,
{ {
SCRIPTAPI_PRECHECKHEADER SCRIPTAPI_PRECHECKHEADER
//infostream<<"scriptapi_luaentity_get_properties: id="<<id<<std::endl;
// Get core.luaentities[id] // Get core.luaentities[id]
luaentity_get(L, id); luaentity_get(L, id);

View file

@ -71,8 +71,12 @@ LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos, const std::string &d
break; break;
} }
// create object // create object
infostream << "LuaEntitySAO::create(name=\"" << name << "\" state=\"" infostream << "LuaEntitySAO::create(name=\"" << name << "\" state is";
<< state << "\")" << std::endl; if (state.empty())
infostream << "empty";
else
infostream << state.size() << " bytes";
infostream << ")" << std::endl;
m_init_name = name; m_init_name = name;
m_init_state = state; m_init_state = state;
@ -281,7 +285,6 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version)
void LuaEntitySAO::getStaticData(std::string *result) const void LuaEntitySAO::getStaticData(std::string *result) const
{ {
verbosestream<<FUNCTION_NAME<<std::endl;
std::ostringstream os(std::ios::binary); std::ostringstream os(std::ios::binary);
// version must be 1 to keep backwards-compatibility. See version2 // version must be 1 to keep backwards-compatibility. See version2
writeU8(os, 1); writeU8(os, 1);

View file

@ -2162,10 +2162,6 @@ void ServerEnvironment::deactivateFarObjects(bool _force_delete)
return false; return false;
} }
verbosestream << "ServerEnvironment::deactivateFarObjects(): "
<< "object id=" << id << " is not known by clients"
<< "; deleting" << std::endl;
// Tell the object about removal // Tell the object about removal
obj->removingFromEnvironment(); obj->removingFromEnvironment();
// Deregister in scripting api // Deregister in scripting api