Skip to content
Permalink
Browse files

Use warningstream for log messages with WARNING

Remove DTIME macro and its uses, too
  • Loading branch information
ShadowNinja authored and kwolekr committed Oct 14, 2015
1 parent 2139d7d commit 96cc5b34fe0151d2a1498eaaafb205757db346c4
@@ -36,7 +36,7 @@ BanManager::BanManager(const std::string &banfilepath):
}
catch(SerializationError &e)
{
infostream<<"WARNING: BanManager: creating "
warningstream<<"BanManager: creating "
<<m_banfilepath<<std::endl;
}
}
@@ -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;
}
@@ -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;
}
@@ -465,7 +465,7 @@ void ItemCAO::updateTexture()
}
catch(SerializationError &e)
{
infostream<<"WARNING: "<<__FUNCTION_NAME
warningstream<<__FUNCTION_NAME
<<": error deSerializing itemstring \""
<<m_itemstring<<std::endl;
}
@@ -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;
@@ -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;
}
@@ -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;
@@ -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;
@@ -89,8 +89,6 @@ __NORETURN extern void sanity_check_fn(

void debug_set_exception_handler();

#define DTIME ""

/*
DebugStack
*/
@@ -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);
}
@@ -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,15 +2157,15 @@ 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;
return;
}
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;

0 comments on commit 96cc5b3

Please sign in to comment.