From 96cc5b34fe0151d2a1498eaaafb205757db346c4 Mon Sep 17 00:00:00 2001
From: ShadowNinja <shadowninja@minetest.net>
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 108319953..57b9f49a5 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 "
 				<<m_banfilepath<<std::endl;
 	}
 }
diff --git a/src/clientobject.cpp b/src/clientobject.cpp
index ae1be092f..a11757ea6 100644
--- a/src/clientobject.cpp
+++ b/src/clientobject.cpp
@@ -47,7 +47,7 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type,
 	n = m_types.find(type);
 	if(n == m_types.end()) {
 		// If factory is not found, just return.
-		dstream<<"WARNING: ClientActiveObject: No factory for type="
+		warningstream<<"ClientActiveObject: No factory for type="
 				<<(int)type<<std::endl;
 		return NULL;
 	}
diff --git a/src/collision.cpp b/src/collision.cpp
index 5d52202d9..193330250 100644
--- a/src/collision.cpp
+++ b/src/collision.cpp
@@ -209,7 +209,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
 		Calculate new velocity
 	*/
 	if( dtime > 0.5 ) {
-		infostream<<"collisionMoveSimple: WARNING: maximum step interval exceeded, lost movement details!"<<std::endl;
+		warningstream<<"collisionMoveSimple: maximum step interval exceeded, lost movement details!"<<std::endl;
 		dtime = 0.5;
 	}
 	speed_f += accel_f * dtime;
@@ -388,7 +388,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
 		loopcount++;
 		if(loopcount >= 100)
 		{
-			infostream<<"collisionMoveSimple: WARNING: Loop count exceeded, aborting to avoid infiniite loop"<<std::endl;
+			warningstream<<"collisionMoveSimple: Loop count exceeded, aborting to avoid infiniite loop"<<std::endl;
 			dtime = 0;
 			break;
 		}
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index de06e4d4b..270483764 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -465,7 +465,7 @@ void ItemCAO::updateTexture()
 	}
 	catch(SerializationError &e)
 	{
-		infostream<<"WARNING: "<<__FUNCTION_NAME
+		warningstream<<__FUNCTION_NAME
 				<<": error deSerializing itemstring \""
 				<<m_itemstring<<std::endl;
 	}
diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp
index dd5f8e6b5..072800d6c 100644
--- a/src/content_nodemeta.cpp
+++ b/src/content_nodemeta.cpp
@@ -174,7 +174,7 @@ void content_nodemeta_deserialize_legacy(std::istream &is,
 
 		if(meta->get(p) != NULL)
 		{
-			infostream<<"WARNING: "<<__FUNCTION_NAME<<": "
+			warningstream<<__FUNCTION_NAME<<": "
 					<<"already set data at position"
 					<<"("<<p.X<<","<<p.Y<<","<<p.Z<<"): Ignoring."
 					<<std::endl;
diff --git a/src/database-leveldb.cpp b/src/database-leveldb.cpp
index e895354a4..acd0fd1eb 100644
--- a/src/database-leveldb.cpp
+++ b/src/database-leveldb.cpp
@@ -57,7 +57,7 @@ bool Database_LevelDB::saveBlock(const v3s16 &pos, const std::string &data)
 	leveldb::Status status = m_database->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 9e47b516f..b15f546b2 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<redisReply *>(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 84b1a7122..da3e2c86b 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 b7521fec2..94b268edd 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 a29b0aab1..59159868e 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 "
 					<<time_ms<<"ms (longer than "
 					<<max_time_ms<<"ms)"<<std::endl;
 			m_active_block_interval_overload_skip = (time_ms / max_time_ms) + 1;
@@ -1910,7 +1910,7 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete)
 					// reason. Unsuccessful attempts have been made to find
 					// said reason.
 					if(id && block->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"
 								<<std::endl;
 						block->m_static_objects.remove(id);
 					}
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index dca7618b9..c5edb967e 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"<<std::endl;
+		warningstream<<"invalid use of 'list' with m_gamedef==0"<<std::endl;
 		return;
 	}
 
@@ -345,7 +345,7 @@ void GUIFormSpecMenu::parseList(parserData* data,std::string element)
 		}
 
 		if(!data->explicit_size)
-			errorstream<<"WARNING: invalid use of list without a size[] element"<<std::endl;
+			warningstream<<"invalid use of list without a size[] element"<<std::endl;
 		m_inventorylists.push_back(ListDrawSpec(loc, listname, pos, geom, start_i));
 		return;
 	}
@@ -525,7 +525,7 @@ void GUIFormSpecMenu::parseImage(parserData* data,std::string element)
 		geom.Y = stof(v_geom[1]) * (float)imgsize.Y;
 
 		if(!data->explicit_size)
-			errorstream<<"WARNING: invalid use of image without a size[] element"<<std::endl;
+			warningstream<<"invalid use of image without a size[] element"<<std::endl;
 		m_images.push_back(ImageDrawSpec(name, pos, geom));
 		return;
 	}
@@ -541,7 +541,7 @@ void GUIFormSpecMenu::parseImage(parserData* data,std::string element)
 		pos.Y += stof(v_pos[1]) * (float) spacing.Y;
 
 		if(!data->explicit_size)
-			errorstream<<"WARNING: invalid use of image without a size[] element"<<std::endl;
+			warningstream<<"invalid use of image without a size[] element"<<std::endl;
 		m_images.push_back(ImageDrawSpec(name, pos));
 		return;
 	}
@@ -571,7 +571,7 @@ void GUIFormSpecMenu::parseItemImage(parserData* data,std::string element)
 		geom.Y = stof(v_geom[1]) * (float)imgsize.Y;
 
 		if(!data->explicit_size)
-			errorstream<<"WARNING: invalid use of item_image without a size[] element"<<std::endl;
+			warningstream<<"invalid use of item_image without a size[] element"<<std::endl;
 		m_itemimages.push_back(ImageDrawSpec(name, pos, geom));
 		return;
 	}
@@ -607,7 +607,7 @@ void GUIFormSpecMenu::parseButton(parserData* data,std::string element,
 						pos.X + geom.X, pos.Y + m_btn_height);
 
 		if(!data->explicit_size)
-			errorstream<<"WARNING: invalid use of button without a size[] element"<<std::endl;
+			warningstream<<"invalid use of button without a size[] element"<<std::endl;
 
 		label = unescape_string(label);
 
@@ -666,7 +666,7 @@ void GUIFormSpecMenu::parseBackground(parserData* data,std::string element)
 		}
 
 		if(!data->explicit_size)
-			errorstream<<"WARNING: invalid use of background without a size[] element"<<std::endl;
+			warningstream<<"invalid use of background without a size[] element"<<std::endl;
 		m_backgrounds.push_back(ImageDrawSpec(name, pos, geom));
 		return;
 	}
@@ -982,7 +982,7 @@ void GUIFormSpecMenu::parseSimpleField(parserData* data,
 	core::rect<s32> rect;
 
 	if(data->explicit_size)
-		errorstream<<"WARNING: invalid use of unpositioned \"field\" in inventory"<<std::endl;
+		warningstream<<"invalid use of unpositioned \"field\" in inventory"<<std::endl;
 
 	v2s32 pos = padding + AbsoluteRect.UpperLeftCorner;
 	pos.Y = ((m_fields.size()+2)*60);
@@ -1088,7 +1088,7 @@ void GUIFormSpecMenu::parseTextArea(parserData* data,
 	core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y);
 
 	if(!data->explicit_size)
-		errorstream<<"WARNING: invalid use of positioned "<<type<<" without a size[] element"<<std::endl;
+		warningstream<<"invalid use of positioned "<<type<<" without a size[] element"<<std::endl;
 
 	if(m_form_src)
 		default_val = m_form_src->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"<<std::endl;
+			warningstream<<"invalid use of label without a size[] element"<<std::endl;
 
 		text = unescape_string(text);
 		std::vector<std::string> 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"<<std::endl;
+			warningstream<<"invalid use of label without a size[] element"<<std::endl;
 
 		std::wstring label = L"";
 
@@ -1326,7 +1326,7 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,
 		core::rect<s32> rect = core::rect<s32>(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"<<std::endl;
+			warningstream<<"invalid use of image_button without a size[] element"<<std::endl;
 
 		image_name = unescape_string(image_name);
 		pressed_image_name = unescape_string(pressed_image_name);
@@ -1449,9 +1449,8 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
 {
 
 	if (m_gamedef == 0) {
-		errorstream <<
-				"WARNING: invalid use of item_image_button with m_gamedef==0"
-				<< std::endl;
+		warningstream << "invalid use of item_image_button with m_gamedef==0"
+			<< std::endl;
 		return;
 	}
 
@@ -1479,7 +1478,7 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
 		core::rect<s32> rect = core::rect<s32>(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"<<std::endl;
+			warningstream<<"invalid use of item_image_button without a size[] element"<<std::endl;
 
 		IItemDefManager *idef = m_gamedef->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 "
 				<<"\""<<s.inventoryloc.dump()<<"\" doesn't exist"
 				<<std::endl;
@@ -2166,7 +2165,7 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase)
 	}
 	InventoryList *ilist = inv->getList(s.listname);
 	if(!ilist){
-		infostream<<"GUIFormSpecMenu::drawList(): WARNING: "
+		warningstream<<"GUIFormSpecMenu::drawList(): "
 				<<"The inventory list \""<<s.listname<<"\" @ \""
 				<<s.inventoryloc.dump()<<"\" doesn't exist"
 				<<std::endl;
diff --git a/src/map.cpp b/src/map.cpp
index 424683d60..a2dbffe66 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -673,7 +673,7 @@ void Map::updateLighting(enum LightBank bank,
 {
 	INodeDefManager *nodemgr = m_gamedef->ndef();
 
-	/*m_dout<<DTIME<<"Map::updateLighting(): "
+	/*m_dout<<"Map::updateLighting(): "
 			<<a_blocks.size()<<" blocks."<<std::endl;*/
 
 	//TimeTaker timer("updateLighting");
@@ -928,7 +928,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
 	INodeDefManager *ndef = m_gamedef->ndef();
 
 	/*PrintInfo(m_dout);
-	m_dout<<DTIME<<"Map::addNodeAndUpdate(): p=("
+	m_dout<<"Map::addNodeAndUpdate(): p=("
 			<<p.X<<","<<p.Y<<","<<p.Z<<")"<<std::endl;*/
 
 	/*
@@ -1028,7 +1028,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
 	{
 		s16 y = p.Y - 1;
 		for(;; y--){
-			//m_dout<<DTIME<<"y="<<y<<std::endl;
+			//m_dout<<"y="<<y<<std::endl;
 			v3s16 n2pos(p.X, y, p.Z);
 
 			MapNode n2;
@@ -1115,7 +1115,7 @@ void Map::removeNodeAndUpdate(v3s16 p,
 	INodeDefManager *ndef = m_gamedef->ndef();
 
 	/*PrintInfo(m_dout);
-	m_dout<<DTIME<<"Map::removeNodeAndUpdate(): p=("
+	m_dout<<"Map::removeNodeAndUpdate(): p=("
 			<<p.X<<","<<p.Y<<","<<p.Z<<")"<<std::endl;*/
 
 	bool node_under_sunlight = true;
@@ -1197,14 +1197,14 @@ void Map::removeNodeAndUpdate(v3s16 p,
 	if(node_under_sunlight)
 	{
 		s16 ybottom = propagateSunlight(p, modified_blocks);
-		/*m_dout<<DTIME<<"Node was under sunlight. "
+		/*m_dout<<"Node was under sunlight. "
 				"Propagating sunlight";
-		m_dout<<DTIME<<" -> ybottom="<<ybottom<<std::endl;*/
+		m_dout<<" -> ybottom="<<ybottom<<std::endl;*/
 		s16 y = p.Y;
 		for(; y >= ybottom; y--)
 		{
 			v3s16 p2(p.X, y, p.Z);
-			/*m_dout<<DTIME<<"lighting neighbors of node ("
+			/*m_dout<<"lighting neighbors of node ("
 					<<p2.X<<","<<p2.Y<<","<<p2.Z<<")"
 					<<std::endl;*/
 			lightNeighbors(LIGHTBANK_DAY, p2, modified_blocks);
@@ -2018,7 +2018,7 @@ NodeMetadata *Map::getNodeMetadata(v3s16 p)
 		block = emergeBlock(blockpos, false);
 	}
 	if(!block){
-		infostream<<"WARNING: Map::getNodeMetadata(): Block not found"
+		warningstream<<"Map::getNodeMetadata(): Block not found"
 				<<std::endl;
 		return NULL;
 	}
@@ -2037,7 +2037,7 @@ bool Map::setNodeMetadata(v3s16 p, NodeMetadata *meta)
 		block = emergeBlock(blockpos, false);
 	}
 	if(!block){
-		infostream<<"WARNING: Map::setNodeMetadata(): Block not found"
+		warningstream<<"Map::setNodeMetadata(): Block not found"
 				<<std::endl;
 		return false;
 	}
@@ -2052,7 +2052,7 @@ void Map::removeNodeMetadata(v3s16 p)
 	MapBlock *block = getBlockNoCreateNoEx(blockpos);
 	if(block == NULL)
 	{
-		infostream<<"WARNING: Map::removeNodeMetadata(): Block not found"
+		warningstream<<"Map::removeNodeMetadata(): Block not found"
 				<<std::endl;
 		return;
 	}
@@ -2070,7 +2070,7 @@ NodeTimer Map::getNodeTimer(v3s16 p)
 		block = emergeBlock(blockpos, false);
 	}
 	if(!block){
-		infostream<<"WARNING: Map::getNodeTimer(): Block not found"
+		warningstream<<"Map::getNodeTimer(): Block not found"
 				<<std::endl;
 		return NodeTimer();
 	}
@@ -2089,7 +2089,7 @@ void Map::setNodeTimer(v3s16 p, NodeTimer t)
 		block = emergeBlock(blockpos, false);
 	}
 	if(!block){
-		infostream<<"WARNING: Map::setNodeTimer(): Block not found"
+		warningstream<<"Map::setNodeTimer(): Block not found"
 				<<std::endl;
 		return;
 	}
@@ -2103,7 +2103,7 @@ void Map::removeNodeTimer(v3s16 p)
 	MapBlock *block = getBlockNoCreateNoEx(blockpos);
 	if(block == NULL)
 	{
-		infostream<<"WARNING: Map::removeNodeTimer(): Block not found"
+		warningstream<<"Map::removeNodeTimer(): Block not found"
 				<<std::endl;
 		return;
 	}
@@ -2164,7 +2164,7 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef, EmergeManager *emer
 							  <<" Using default settings."<<std::endl;
 				}
 				catch(FileNotGoodException &e){
-					infostream<<"WARNING: Could not load map metadata"
+					warningstream<<"Could not load map metadata"
 							//<<" Disabling chunk-based generator."
 							<<std::endl;
 					//m_chunksize = 0;
@@ -2188,10 +2188,10 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef, EmergeManager *emer
 	}
 	catch(std::exception &e)
 	{
-		infostream<<"WARNING: ServerMap: Failed to load map from "<<savedir
+		warningstream<<"ServerMap: Failed to load map from "<<savedir
 				<<", exception: "<<e.what()<<std::endl;
 		infostream<<"Please remove the map or fix it."<<std::endl;
-		infostream<<"WARNING: Map saving will be disabled."<<std::endl;
+		warningstream<<"Map saving will be disabled."<<std::endl;
 	}
 
 	infostream<<"Initializing new map."<<std::endl;
@@ -2798,7 +2798,7 @@ void ServerMap::createDirs(std::string path)
 {
 	if(fs::CreateAllDirs(path) == false)
 	{
-		m_dout<<DTIME<<"ServerMap: Failed to create directory "
+		m_dout<<"ServerMap: Failed to create directory "
 				<<"\""<<path<<"\""<<std::endl;
 		throw BaseException("ServerMap failed to create directory");
 	}
@@ -2882,7 +2882,7 @@ void ServerMap::save(ModifiedState save_level)
 {
 	DSTACK(__FUNCTION_NAME);
 	if(m_map_saving_enabled == false) {
-		infostream<<"WARNING: Not saving map, saving disabled."<<std::endl;
+		warningstream<<"Not saving map, saving disabled."<<std::endl;
 		return;
 	}
 
@@ -3256,7 +3256,7 @@ bool ServerMap::saveBlock(MapBlock *block, Database *db)
 
 	// Dummy blocks are not written
 	if (block->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="<<fullpath
 				<<" (SerializationError). "
 				<<"what()="<<e.what()
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index 942457407..be16c3bb7 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -707,7 +707,7 @@ void MapBlock::deSerialize(std::istream &is, u8 version, bool disk)
 				&m_node_metadata, &m_node_timers,
 				m_gamedef->idef());
 	} catch(SerializationError &e) {
-		errorstream<<"WARNING: MapBlock::deSerialize(): Ignoring an error"
+		warningstream<<"MapBlock::deSerialize(): Ignoring an error"
 				<<" while deserializing node metadata at ("
 				<<PP(getPos())<<": "<<e.what()<<std::endl;
 	}
@@ -770,7 +770,7 @@ void MapBlock::deSerializeNetworkSpecific(std::istream &is)
 	}
 	catch(SerializationError &e)
 	{
-		errorstream<<"WARNING: MapBlock::deSerializeNetworkSpecific(): Ignoring an error"
+		warningstream<<"MapBlock::deSerializeNetworkSpecific(): Ignoring an error"
 				<<": "<<e.what()<<std::endl;
 	}
 }
@@ -797,12 +797,12 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
 		is.read(&tmp, 1);
 		if (is.gcount() != 1)
 			throw SerializationError(std::string(__FUNCTION_NAME)
-				+ ": no enough input data");
+				+ ": not enough input data");
 		is_underground = tmp;
 		is.read((char *)*databuf_nodelist, nodecount * ser_length);
 		if ((u32)is.gcount() != nodecount * ser_length)
 			throw SerializationError(std::string(__FUNCTION_NAME)
-				+ ": no enough input data");
+				+ ": not enough input data");
 	} else if (version <= 10) {
 		u8 t8;
 		is.read((char *)&t8, 1);
@@ -815,7 +815,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
 			std::string s = os.str();
 			if (s.size() != nodecount)
 				throw SerializationError(std::string(__FUNCTION_NAME)
-					+ ": no enough input data");
+					+ ": not enough input data");
 			for (u32 i = 0; i < s.size(); i++) {
 				databuf_nodelist[i*ser_length] = s[i];
 			}
@@ -827,7 +827,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
 			std::string s = os.str();
 			if (s.size() != nodecount)
 				throw SerializationError(std::string(__FUNCTION_NAME)
-					+ ": no enough input data");
+					+ ": not enough input data");
 			for (u32 i = 0; i < s.size(); i++) {
 				databuf_nodelist[i*ser_length + 1] = s[i];
 			}
@@ -840,7 +840,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
 			std::string s = os.str();
 			if (s.size() != nodecount)
 				throw SerializationError(std::string(__FUNCTION_NAME)
-					+ ": no enough input data");
+					+ ": not enough input data");
 			for (u32 i = 0; i < s.size(); i++) {
 				databuf_nodelist[i*ser_length + 2] = s[i];
 			}
@@ -891,7 +891,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
 						m_gamedef->idef());
 				}
 			} catch(SerializationError &e) {
-				errorstream<<"WARNING: MapBlock::deSerialize(): Ignoring an error"
+				warningstream<<"MapBlock::deSerialize(): Ignoring an error"
 						<<" while deserializing node metadata"<<std::endl;
 			}
 		}
@@ -910,7 +910,7 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
 			u16 count = readU16(is);
 			// Not supported and length not known if count is not 0
 			if(count != 0){
-				errorstream<<"WARNING: MapBlock::deSerialize_pre22(): "
+				warningstream<<"MapBlock::deSerialize_pre22(): "
 						<<"Ignoring stuff coming at and after MBOs"<<std::endl;
 				return;
 			}
diff --git a/src/mapsector.cpp b/src/mapsector.cpp
index 9ce3c8eb3..1588a5962 100644
--- a/src/mapsector.cpp
+++ b/src/mapsector.cpp
@@ -220,7 +220,7 @@ ServerMapSector* ServerMapSector::deSerialize(
 
 	if(n != sectors.end())
 	{
-		dstream<<"WARNING: deSerializing existent sectors not supported "
+		warningstream<<"deSerializing existent sectors not supported "
 				"at the moment, because code hasn't been tested."
 				<<std::endl;
 
diff --git a/src/mods.cpp b/src/mods.cpp
index a81dd4604..90e0816d9 100644
--- a/src/mods.cpp
+++ b/src/mods.cpp
@@ -256,7 +256,7 @@ void ModConfiguration::addMods(std::vector<ModSpec> 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: \""
 					<<mod.name<<"\""<<std::endl
 					<<"Will not load: "<<oldmod.path<<std::endl
 					<<"Overridden by: "<<mod.path<<std::endl;
@@ -270,7 +270,7 @@ void ModConfiguration::addMods(std::vector<ModSpec> 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: \""
 					<<mod.name<<"\""<<std::endl
 					<<"Will not load: "<<oldmod.path<<std::endl
 					<<"Will not load: "<<mod.path<<std::endl;
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index d49c96029..a49bbe167 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -579,7 +579,7 @@ void Client::handleCommand_MovePlayer(NetworkPacket* pkt)
 
 void Client::handleCommand_PlayerItem(NetworkPacket* pkt)
 {
-	infostream << "Client: WARNING: Ignoring TOCLIENT_PLAYERITEM" << std::endl;
+	warningstream << "Client: Ignoring TOCLIENT_PLAYERITEM" << std::endl;
 }
 
 void Client::handleCommand_DeathScreen(NetworkPacket* pkt)
@@ -711,7 +711,7 @@ void Client::handleCommand_Media(NetworkPacket* pkt)
 
 void Client::handleCommand_ToolDef(NetworkPacket* pkt)
 {
-	infostream << "Client: WARNING: Ignoring TOCLIENT_TOOLDEF" << std::endl;
+	warningstream << "Client: Ignoring TOCLIENT_TOOLDEF" << std::endl;
 }
 
 void Client::handleCommand_NodeDef(NetworkPacket* pkt)
@@ -738,7 +738,7 @@ void Client::handleCommand_NodeDef(NetworkPacket* pkt)
 
 void Client::handleCommand_CraftItemDef(NetworkPacket* pkt)
 {
-	infostream << "Client: WARNING: Ignoring TOCLIENT_CRAFTITEMDEF" << std::endl;
+	warningstream << "Client: Ignoring TOCLIENT_CRAFTITEMDEF" << std::endl;
 }
 
 void Client::handleCommand_ItemDef(NetworkPacket* pkt)
diff --git a/src/network/connection.cpp b/src/network/connection.cpp
index d73d4ba17..0738c6a1f 100644
--- a/src/network/connection.cpp
+++ b/src/network/connection.cpp
@@ -2099,6 +2099,7 @@ void * ConnectionReceiveThread::run()
 #endif
 		END_DEBUG_EXCEPTION_HANDLER(errorstream);
 	}
+
 	PROFILE(g_profiler->remove(ThreadIdentifier.str()));
 	return NULL;
 }
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 0bf7e4769..d9ff564da 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 5a1578bba..b5ccc3b94 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"<<std::endl;
 		return CONTENT_IGNORE;
 	}
@@ -663,7 +663,7 @@ content_t CNodeDefManager::set(const std::string &name, const ContentFeatures &d
 		// Get new id
 		id = allocateId();
 		if (id == CONTENT_IGNORE) {
-			infostream << "NodeDefManager: WARNING: Absolute "
+			warningstream << "NodeDefManager: Absolute "
 				"limit reached" << std::endl;
 			return CONTENT_IGNORE;
 		}
@@ -1112,12 +1112,12 @@ void CNodeDefManager::deSerialize(std::istream &is)
 
 		// Check error conditions
 		if (i == CONTENT_IGNORE || i == CONTENT_AIR || i == CONTENT_UNKNOWN) {
-			infostream << "NodeDefManager::deSerialize(): WARNING: "
+			warningstream << "NodeDefManager::deSerialize(): "
 				"not changing builtin node " << i << std::endl;
 			continue;
 		}
 		if (f.name == "") {
-			infostream << "NodeDefManager::deSerialize(): WARNING: "
+			warningstream << "NodeDefManager::deSerialize(): "
 				"received empty name" << std::endl;
 			continue;
 		}
@@ -1125,7 +1125,7 @@ void CNodeDefManager::deSerialize(std::istream &is)
 		// Ignore aliases
 		u16 existing_id;
 		if (m_name_id_mapping.getId(f.name, existing_id) && i != existing_id) {
-			infostream << "NodeDefManager::deSerialize(): WARNING: "
+			warningstream << "NodeDefManager::deSerialize(): "
 				"already defined with different ID: " << f.name << std::endl;
 			continue;
 		}
diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp
index d63dac696..9c74dcd28 100644
--- a/src/nodemetadata.cpp
+++ b/src/nodemetadata.cpp
@@ -139,7 +139,7 @@ void NodeMetadataList::deSerialize(std::istream &is, IItemDefManager *item_def_m
 		p.X = p16;
 
 		if (m_data.find(p) != m_data.end()) {
-			infostream<<"WARNING: NodeMetadataList::deSerialize(): "
+			warningstream<<"NodeMetadataList::deSerialize(): "
 					<<"already set data at position"
 					<<"("<<p.X<<","<<p.Y<<","<<p.Z<<"): Ignoring."
 					<<std::endl;
diff --git a/src/nodetimer.cpp b/src/nodetimer.cpp
index 1feefa203..350940546 100644
--- a/src/nodetimer.cpp
+++ b/src/nodetimer.cpp
@@ -108,7 +108,7 @@ void NodeTimerList::deSerialize(std::istream &is, u8 map_format_version)
 
 		if(t.timeout <= 0)
 		{
-			infostream<<"WARNING: NodeTimerList::deSerialize(): "
+			warningstream<<"NodeTimerList::deSerialize(): "
 					<<"invalid data at position"
 					<<"("<<p.X<<","<<p.Y<<","<<p.Z<<"): Ignoring."
 					<<std::endl;
@@ -117,7 +117,7 @@ void NodeTimerList::deSerialize(std::istream &is, u8 map_format_version)
 
 		if(m_data.find(p) != m_data.end())
 		{
-			infostream<<"WARNING: NodeTimerList::deSerialize(): "
+			warningstream<<"NodeTimerList::deSerialize(): "
 					<<"already set data at position"
 					<<"("<<p.X<<","<<p.Y<<","<<p.Z<<"): Ignoring."
 					<<std::endl;
diff --git a/src/porting.cpp b/src/porting.cpp
index d0dfc801f..ced41d4fb 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -75,13 +75,13 @@ bool * signal_handler_killstatus(void)
 
 void sigint_handler(int sig)
 {
-	if(!g_killed) {
-		dstream<<DTIME<<"INFO: sigint_handler(): "
-				<<"Ctrl-C pressed, shutting down."<<std::endl;
+	if (!g_killed) {
+		dstream << "INFO: sigint_handler(): "
+			<< "Ctrl-C pressed, shutting down." << std::endl;
 
 		// Comment out for less clutter when testing scripts
-		/*dstream<<DTIME<<"INFO: sigint_handler(): "
-				<<"Printing debug stacks"<<std::endl;
+		/*dstream << "INFO: sigint_handler(): "
+				<< "Printing debug stacks" << std::endl;
 		debug_stacks_print();*/
 
 		g_killed = true;
@@ -105,8 +105,8 @@ BOOL WINAPI event_handler(DWORD sig)
 	case CTRL_CLOSE_EVENT:
 	case CTRL_LOGOFF_EVENT:
 	case CTRL_SHUTDOWN_EVENT:
-		if (g_killed == false) {
-			dstream << DTIME << "INFO: event_handler(): "
+		if (!g_killed) {
+			dstream << "INFO: event_handler(): "
 				<< "Ctrl+C, Close Event, Logoff Event or Shutdown Event,"
 				" shutting down." << std::endl;
 			g_killed = true;
@@ -401,14 +401,14 @@ bool setSystemPaths()
 		const std::string &trypath = *i;
 		if (!fs::PathExists(trypath) ||
 			!fs::PathExists(trypath + DIR_DELIM + "builtin")) {
-			dstream << "WARNING: system-wide share not found at \""
+			warningstream << "system-wide share not found at \""
 					<< trypath << "\""<< std::endl;
 			continue;
 		}
 
 		// Warn if was not the first alternative
 		if (i != trylist.begin()) {
-			dstream << "WARNING: system-wide share found at \""
+			warningstream << "system-wide share found at \""
 					<< trypath << "\"" << std::endl;
 		}
 
@@ -437,7 +437,7 @@ bool setSystemPaths()
 			TRUE, (UInt8 *)path, PATH_MAX)) {
 		path_share = std::string(path);
 	} else {
-		dstream << "WARNING: Could not determine bundle resource path" << std::endl;
+		warningstream << "Could not determine bundle resource path" << std::endl;
 	}
 	CFRelease(resources_url);
 
diff --git a/src/server.cpp b/src/server.cpp
index b0f69f1c3..8f105ffd2 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -693,7 +693,7 @@ void Server::AsyncRunStep(bool initial_step)
 			Player *player = m_env->getPlayer(client->peer_id);
 			if(player == NULL) {
 				// This can happen if the client timeouts somehow
-				/*infostream<<"WARNING: "<<__FUNCTION_NAME<<": Client "
+				/*warningstream<<__FUNCTION_NAME<<": Client "
 						<<client->peer_id
 						<<" has no associated player"<<std::endl;*/
 				continue;
@@ -746,7 +746,7 @@ void Server::AsyncRunStep(bool initial_step)
 				// Get object type
 				u8 type = ACTIVEOBJECT_TYPE_INVALID;
 				if(obj == NULL)
-					infostream<<"WARNING: "<<__FUNCTION_NAME
+					warningstream<<__FUNCTION_NAME
 							<<": NULL object"<<std::endl;
 				else
 					type = obj->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 699040bf2..236d7e8dc 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="
 				<<type<<std::endl;
 		return NULL;
 	}
diff --git a/src/sound_openal.cpp b/src/sound_openal.cpp
index 195775396..df316fbf0 100644
--- a/src/sound_openal.cpp
+++ b/src/sound_openal.cpp
@@ -92,7 +92,7 @@ static ALenum warn_if_error(ALenum err, const char *desc)
 {
 	if(err == AL_NO_ERROR)
 		return err;
-	errorstream<<"WARNING: "<<desc<<": "<<alErrorString(err)<<std::endl;
+	warningstream<<desc<<": "<<alErrorString(err)<<std::endl;
 	return err;
 }
 
diff --git a/src/staticobject.h b/src/staticobject.h
index 95a1b945e..208fb2cc8 100644
--- a/src/staticobject.h
+++ b/src/staticobject.h
@@ -79,7 +79,7 @@ class StaticObjectList
 		assert(id != 0); // Pre-condition
 		if(m_active.find(id) == m_active.end())
 		{
-			dstream<<"WARNING: StaticObjectList::remove(): id="<<id
+			warningstream<<"StaticObjectList::remove(): id="<<id
 					<<" not found"<<std::endl;
 			return;
 		}
-- 
GitLab