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

@ -1317,9 +1317,7 @@ void Client::sendChatMessage(const std::wstring &message)
m_chat_message_allowance -= 1.0f;
NetworkPacket pkt(TOSERVER_CHAT_MESSAGE, 2 + message.size() * sizeof(u16));
pkt << message;
Send(&pkt);
} else if (m_out_chat_queue.size() < (u16) max_queue_size || max_queue_size < 0) {
m_out_chat_queue.push(message);
@ -1701,8 +1699,11 @@ void Client::typeChatMessage(const std::wstring &message)
if (message.empty())
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 (m_mods_loaded && m_script->on_sending_message(wide_to_utf8(message)))
if (m_mods_loaded && m_script->on_sending_message(message_utf8))
return;
// Send to others

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

@ -195,16 +195,7 @@ void RenderingEngine::cleanupMeshCache()
bool RenderingEngine::setupTopLevelWindow()
{
// FIXME: It would make more sense for there to be a switch of some
// 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;
return setWindowIcon();
}
bool RenderingEngine::setWindowIcon()

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

@ -412,7 +412,9 @@ queue_full_break:
if (d > full_d_max) {
new_nearest_unsent_d = 0;
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;
} else {
if (nearest_sent_d != -1)

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

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

@ -91,14 +91,15 @@ bool MapBlock::onObjectsActivation()
if (m_static_objects.getAllStored().empty())
return false;
const auto count = m_static_objects.getStoredSize();
verbosestream << "MapBlock::onObjectsActivation(): "
<< "activating objects of block " << getPos() << " ("
<< m_static_objects.getStoredSize() << " objects)" << std::endl;
<< "activating " << count << "objects in block " << getPos()
<< 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: "
<< m_static_objects.getStoredSize() << " in "
<< getPos() << "; removing all of them." << std::endl;
<< count << " in " << getPos() << "; removing all of them."
<< std::endl;
// Clear stored list
m_static_objects.clearStored();
raiseModified(MOD_STATE_WRITE_NEEDED, MOD_REASON_TOO_MANY_OBJECTS);

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

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

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