From 96cc5b34fe0151d2a1498eaaafb205757db346c4 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Wed, 14 Oct 2015 01:26:03 -0400 Subject: [PATCH] Use warningstream for log messages with WARNING Remove DTIME macro and its uses, too --- src/ban.cpp | 2 +- src/clientobject.cpp | 2 +- src/collision.cpp | 4 +-- src/content_cao.cpp | 2 +- src/content_nodemeta.cpp | 2 +- src/database-leveldb.cpp | 4 +-- src/database-redis.cpp | 6 ++--- src/database-sqlite3.cpp | 2 +- src/debug.h | 2 -- src/environment.cpp | 4 +-- src/guiFormSpecMenu.cpp | 35 ++++++++++++------------- src/map.cpp | 40 ++++++++++++++--------------- src/mapblock.cpp | 18 ++++++------- src/mapsector.cpp | 2 +- src/mods.cpp | 4 +-- src/network/clientpackethandler.cpp | 6 ++--- src/network/connection.cpp | 1 + src/network/serverpackethandler.cpp | 2 +- src/nodedef.cpp | 10 ++++---- src/nodemetadata.cpp | 2 +- src/nodetimer.cpp | 4 +-- src/porting.cpp | 20 +++++++-------- src/server.cpp | 6 ++--- src/serverobject.cpp | 2 +- src/sound_openal.cpp | 2 +- src/staticobject.h | 2 +- 26 files changed, 92 insertions(+), 94 deletions(-) diff --git a/src/ban.cpp b/src/ban.cpp index 10831995..57b9f49a 100644 --- a/src/ban.cpp +++ b/src/ban.cpp @@ -36,7 +36,7 @@ BanManager::BanManager(const std::string &banfilepath): } catch(SerializationError &e) { - infostream<<"WARNING: BanManager: creating " + warningstream<<"BanManager: creating " <= 100) { - infostream<<"collisionMoveSimple: WARNING: Loop count exceeded, aborting to avoid infiniite loop"<get(p) != NULL) { - infostream<<"WARNING: "<<__FUNCTION_NAME<<": " + warningstream<<__FUNCTION_NAME<<": " <<"already set data at position" <<"("<Put(leveldb::WriteOptions(), i64tos(getBlockAsInteger(pos)), data); if (!status.ok()) { - errorstream << "WARNING: saveBlock: LevelDB error saving block " + warningstream << "saveBlock: LevelDB error saving block " << PP(pos) << ": " << status.ToString() << std::endl; return false; } @@ -82,7 +82,7 @@ bool Database_LevelDB::deleteBlock(const v3s16 &pos) leveldb::Status status = m_database->Delete(leveldb::WriteOptions(), i64tos(getBlockAsInteger(pos))); if (!status.ok()) { - errorstream << "WARNING: deleteBlock: LevelDB error deleting block " + warningstream << "deleteBlock: LevelDB error deleting block " << PP(pos) << ": " << status.ToString() << std::endl; return false; } diff --git a/src/database-redis.cpp b/src/database-redis.cpp index 9e47b516..b15f546b 100644 --- a/src/database-redis.cpp +++ b/src/database-redis.cpp @@ -84,14 +84,14 @@ bool Database_Redis::saveBlock(const v3s16 &pos, const std::string &data) redisReply *reply = static_cast(redisCommand(ctx, "HSET %s %s %b", hash.c_str(), tmp.c_str(), data.c_str(), data.size())); if (!reply) { - errorstream << "WARNING: saveBlock: redis command 'HSET' failed on " + warningstream << "saveBlock: redis command 'HSET' failed on " "block " << PP(pos) << ": " << ctx->errstr << std::endl; freeReplyObject(reply); return false; } if (reply->type == REDIS_REPLY_ERROR) { - errorstream << "WARNING: saveBlock: saving block " << PP(pos) + warningstream << "saveBlock: saving block " << PP(pos) << " failed: " << reply->str << std::endl; freeReplyObject(reply); return false; @@ -150,7 +150,7 @@ bool Database_Redis::deleteBlock(const v3s16 &pos) throw FileNotGoodException(std::string( "Redis command 'HDEL %s %s' failed: ") + ctx->errstr); } else if (reply->type == REDIS_REPLY_ERROR) { - errorstream << "WARNING: deleteBlock: deleting block " << PP(pos) + warningstream << "deleteBlock: deleting block " << PP(pos) << " failed: " << reply->str << std::endl; freeReplyObject(reply); return false; diff --git a/src/database-sqlite3.cpp b/src/database-sqlite3.cpp index 84b1a712..da3e2c86 100644 --- a/src/database-sqlite3.cpp +++ b/src/database-sqlite3.cpp @@ -153,7 +153,7 @@ bool Database_SQLite3::deleteBlock(const v3s16 &pos) sqlite3_reset(m_stmt_delete); if (!good) { - errorstream << "WARNING: deleteBlock: Block failed to delete " + warningstream << "deleteBlock: Block failed to delete " << PP(pos) << ": " << sqlite3_errmsg(m_database) << std::endl; } return good; diff --git a/src/debug.h b/src/debug.h index b7521fec..94b268ed 100644 --- a/src/debug.h +++ b/src/debug.h @@ -89,8 +89,6 @@ __NORETURN extern void sanity_check_fn( void debug_set_exception_handler(); -#define DTIME "" - /* DebugStack */ diff --git a/src/environment.cpp b/src/environment.cpp index a29b0aab..59159868 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1188,7 +1188,7 @@ void ServerEnvironment::step(float dtime) u32 time_ms = timer.stop(true); u32 max_time_ms = 200; if(time_ms > max_time_ms){ - infostream<<"WARNING: active block modifiers took " + warningstream<<"active block modifiers took " <m_static_objects.m_active.find(id) != block->m_static_objects.m_active.end()){ - infostream<<"ServerEnv: WARNING: Performing hack #83274" + warningstream<<"ServerEnv: Performing hack #83274" <m_static_objects.remove(id); } diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index dca7618b..c5edb967 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -300,7 +300,7 @@ void GUIFormSpecMenu::parseSize(parserData* data,std::string element) void GUIFormSpecMenu::parseList(parserData* data,std::string element) { if (m_gamedef == 0) { - errorstream<<"WARNING: invalid use of 'list' with m_gamedef==0"<explicit_size) - errorstream<<"WARNING: invalid use of list without a size[] element"<explicit_size) - errorstream<<"WARNING: invalid use of image without a size[] element"<explicit_size) - errorstream<<"WARNING: invalid use of image without a size[] element"<explicit_size) - errorstream<<"WARNING: invalid use of item_image without a size[] element"<explicit_size) - errorstream<<"WARNING: invalid use of button without a size[] element"<explicit_size) - errorstream<<"WARNING: invalid use of background without a size[] element"< rect; if(data->explicit_size) - errorstream<<"WARNING: invalid use of unpositioned \"field\" in inventory"< rect = core::rect(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y); if(!data->explicit_size) - errorstream<<"WARNING: invalid use of positioned "<resolveText(default_val); @@ -1195,7 +1195,7 @@ void GUIFormSpecMenu::parseLabel(parserData* data,std::string element) pos.Y += (stof(v_pos[1]) + 7.0/30.0) * (float)spacing.Y; if(!data->explicit_size) - errorstream<<"WARNING: invalid use of label without a size[] element"< lines = split(text, '\n'); @@ -1260,7 +1260,7 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data,std::string element) //actually text.length() would be correct but adding +1 avoids to break all mods if(!data->explicit_size) - errorstream<<"WARNING: invalid use of label without a size[] element"< rect = core::rect(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y); if(!data->explicit_size) - errorstream<<"WARNING: invalid use of image_button without a size[] element"< rect = core::rect(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y); if(!data->explicit_size) - errorstream<<"WARNING: invalid use of item_image_button without a size[] element"<idef(); ItemStack item; @@ -2158,7 +2157,7 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase) Inventory *inv = m_invmgr->getInventory(s.inventoryloc); if(!inv){ - infostream<<"GUIFormSpecMenu::drawList(): WARNING: " + warningstream<<"GUIFormSpecMenu::drawList(): " <<"The inventory location " <<"\""<getList(s.listname); if(!ilist){ - infostream<<"GUIFormSpecMenu::drawList(): WARNING: " + warningstream<<"GUIFormSpecMenu::drawList(): " <<"The inventory list \""<ndef(); - /*m_dout<ndef(); /*PrintInfo(m_dout); - m_dout< ybottom="< ybottom="<= ybottom; y--) { v3s16 p2(p.X, y, p.Z); - /*m_dout<isDummy()) { - errorstream << "WARNING: saveBlock: Not writing dummy block " + warningstream << "saveBlock: Not writing dummy block " << PP(p3d) << std::endl; return true; } @@ -3346,7 +3346,7 @@ void ServerMap::loadBlock(std::string sectordir, std::string blockfile, } catch(SerializationError &e) { - infostream<<"WARNING: Invalid block data on disk " + warningstream<<"Invalid block data on disk " <<"fullpath="<idef()); } } catch(SerializationError &e) { - errorstream<<"WARNING: MapBlock::deSerialize(): Ignoring an error" + warningstream<<"MapBlock::deSerialize(): Ignoring an error" <<" while deserializing node metadata"< new_mods) // BAD CASE: name conflict in different levels. u32 oldindex = existing_mods[mod.name]; const ModSpec &oldmod = m_unsatisfied_mods[oldindex]; - actionstream<<"WARNING: Mod name conflict detected: \"" + warningstream<<"Mod name conflict detected: \"" < new_mods) // VERY BAD CASE: name conflict in the same level. u32 oldindex = existing_mods[mod.name]; const ModSpec &oldmod = m_unsatisfied_mods[oldindex]; - errorstream<<"WARNING: Mod name conflict detected: \"" + warningstream<<"Mod name conflict detected: \"" <remove(ThreadIdentifier.str())); return NULL; } diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 0bf7e476..d9ff564d 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -1713,7 +1713,7 @@ void Server::handleCommand_Interact(NetworkPacket* pkt) Catch invalid actions */ else { - infostream << "WARNING: Server: Invalid action " + warningstream << "Server: Invalid action " << action << std::endl; } } diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 5a1578bb..b5ccc3b9 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -653,7 +653,7 @@ content_t CNodeDefManager::set(const std::string &name, const ContentFeatures &d // Don't allow redefining ignore (but allow air and unknown) if (name == "ignore") { - infostream << "NodeDefManager: WARNING: Ignoring " + warningstream << "NodeDefManager: Ignoring " "CONTENT_IGNORE redefinition"<getPlayer(client->peer_id); if(player == NULL) { // This can happen if the client timeouts somehow - /*infostream<<"WARNING: "<<__FUNCTION_NAME<<": Client " + /*warningstream<<__FUNCTION_NAME<<": Client " <peer_id <<" has no associated player"<getSendType(); @@ -931,7 +931,7 @@ void Server::AsyncRunStep(bool initial_step) break; default: prof.add("unknown", 1); - infostream << "WARNING: Server: Unknown MapEditEvent " + warningstream << "Server: Unknown MapEditEvent " << ((u32)event->type) << std::endl; break; } diff --git a/src/serverobject.cpp b/src/serverobject.cpp index 699040bf..236d7e8d 100644 --- a/src/serverobject.cpp +++ b/src/serverobject.cpp @@ -52,7 +52,7 @@ ServerActiveObject* ServerActiveObject::create(ActiveObjectType type, } // If factory is not found, just return. - dstream<<"WARNING: ServerActiveObject: No factory for type=" + warningstream<<"ServerActiveObject: No factory for type=" <