From: Perttu Ahola Date: Sun, 11 Mar 2012 02:15:45 +0000 (+0200) Subject: Clean up log messages everywhere X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=f1d9880006cf713597c1fc573f83db75062712c9;p=zefram%2Fminetest%2Fminetest_engine.git Clean up log messages everywhere --- diff --git a/share/server/games/mesetint/mods/experimental/init.lua b/share/server/games/mesetint/mods/experimental/init.lua index 1ee3fdc2..364eeb10 100644 --- a/share/server/games/mesetint/mods/experimental/init.lua +++ b/share/server/games/mesetint/mods/experimental/init.lua @@ -609,8 +609,8 @@ minetest.register_abm({ end, })--]] -print("experimental modname="..dump(minetest.get_current_modname())) -print("experimental modpath="..dump(minetest.get_modpath("experimental"))) -print("experimental worldpath="..dump(minetest.get_worldpath())) +minetest.log("experimental modname="..dump(minetest.get_current_modname())) +minetest.log("experimental modpath="..dump(minetest.get_modpath("experimental"))) +minetest.log("experimental worldpath="..dump(minetest.get_worldpath())) -- END diff --git a/src/clouds.cpp b/src/clouds.cpp index 23243659..784d611f 100644 --- a/src/clouds.cpp +++ b/src/clouds.cpp @@ -38,8 +38,6 @@ Clouds::Clouds( m_camera_pos(0,0), m_time(0) { - dstream<<__FUNCTION_NAME<dump()< +#include "log.h" #if USE_GETTEXT #include @@ -41,9 +41,9 @@ inline void changeCtype(const char *l) char *ret = NULL; ret = setlocale(LC_CTYPE, l); if(ret == NULL) - std::cout<<"locale could not be set"< "<__| \\___ >____ > |__| "<::Iterator i = m_modspaths.begin(); i != m_modspaths.end(); i++){ std::string modspath = *i; - infostream<<" "<::Iterator i = m_mods.begin(); + i != m_mods.end(); i++){ + const ModSpec &mod = *i; + infostream<::Iterator i = m_mods.begin(); i != m_mods.end(); i++){ const ModSpec &mod = *i; - infostream<<"Server: Loading mod \""<__| \\___ >____ > |__| "<peer_id, 0, reply, true); - infostream<<"Server: Sent object remove/add: " + verbosestream<<"Server: Sent object remove/add: " <= 4) disable_single_change_sending = true; - bool got_any_events = false; + int event_count = m_unsent_map_edit_queue.size(); // We'll log the amount of each Profiler prof; while(m_unsent_map_edit_queue.size() != 0) { - got_any_events = true; - MapEditEvent* event = m_unsent_map_edit_queue.pop_front(); // Players far away from the change are stored here. @@ -1776,10 +1802,12 @@ void Server::AsyncRunStep() break;*/ } - if(got_any_events) - { + if(event_count >= 5){ infostream<<"Server: MapEditEvents:"<serialization_version; @@ -1920,7 +1950,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) if(datasize < 2+1+PLAYERNAME_SIZE) return; - infostream<<"Server: Got TOSERVER_INIT from " + verbosestream<<"Server: Got TOSERVER_INIT from " < tosend; - u16 numtextures = readU16(is); - for(int i = 0; i < numtextures; i++) { + infostream<<"Sending "<getName() + verbosestream<<"TOSERVER_INTERACT: "<getName() <<" tried to interact, but is dead!"<getActiveObject(pointed.object_id); if(pointed_object == NULL) { - infostream<<"TOSERVER_INTERACT: " + verbosestream<<"TOSERVER_INTERACT: " "pointed object is NULL"<getName()<<" punches object " - <getDescription()<getWieldedItem(); ToolCapabilities toolcap = @@ -3031,7 +3070,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) return; actionstream<getName()<<" right-clicks object " - <getDescription()<rightClick(srp); @@ -3238,7 +3278,7 @@ core::list Server::getPlayerInfo() void Server::peerAdded(con::Peer *peer) { DSTACK(__FUNCTION_NAME); - infostream<<"Server::peerAdded(): peer->id=" + verbosestream<<"Server::peerAdded(): peer->id=" <id<id=" + verbosestream<<"Server::deletingPeer(): peer->id=" <id<<", timeout="<::Iterator i = m_mods.begin(); - i != m_mods.end(); i++){ - const ModSpec &mod = *i; - std::string texturepath = mod.path + DIR_DELIM + "textures"; - std::vector dirlist = fs::GetDirListing(texturepath); - for(u32 j=0; j dirlist = fs::GetDirListing(texturepath); + for(u32 j=0; jm_Textures[tname] = TextureInformation(tpath,digest_string); - infostream<<"Server::PrepareTextures(): added sha1 for "<< tname <m_Textures[tname] = TextureInformation(tpath,digest_string); + verbosestream<<"Server: sha1 for "< texture_announcements; @@ -3881,7 +3923,6 @@ void Server::SendTextureAnnouncement(u16 peer_id){ // Make data buffer std::string s = os.str(); - infostream<<"Server::SendTextureAnnouncement(): Send to client"< data((u8*)s.c_str(), s.size()); // Send as reliable @@ -3906,7 +3947,8 @@ struct SendableTexture void Server::SendTexturesRequested(u16 peer_id,core::list tosend) { DSTACK(__FUNCTION_NAME); - infostream<<"Server::SendTexturesRequested(): Sending textures to client"< tosend // Make data buffer std::string s = os.str(); - infostream<<"Server::SendTexturesRequested(): bunch "<clear(); } } - - /* - Player info - */ - static int counter = 0; - counter--; - if(counter <= 0) - { - counter = 10; - - core::list list = server.getPlayerInfo(); - core::list::Iterator i; - static u32 sum_old = 0; - u32 sum = PIChecksum(list); - if(sum != sum_old) - { - infostream<PrintLine(&infostream); - } - } - sum_old = sum; - } } } diff --git a/src/server.h b/src/server.h index 50cd5b28..a1d7e5df 100644 --- a/src/server.h +++ b/src/server.h @@ -40,6 +40,23 @@ class IWritableItemDefManager; class IWritableNodeDefManager; class IWritableCraftDefManager; +class ServerError : public std::exception +{ +public: + ServerError(const std::string &s) + { + m_s = "ServerError: "; + m_s += s; + } + virtual ~ServerError() throw() + {} + virtual const char * what() const throw() + { + return m_s.c_str(); + } + std::string m_s; +}; + /* Some random functions */ @@ -211,8 +228,6 @@ struct PlayerInfo void PrintLine(std::ostream *s); }; -u32 PIChecksum(core::list &l); - /* Used for queueing and sorting block transfers in containers @@ -608,7 +623,7 @@ private: { Player *player = m_env->getPlayer(peer_id); if(player == NULL) - return "[id="+itos(peer_id); + return "[id="+itos(peer_id)+"]"; return player->getName(); } diff --git a/src/settings.h b/src/settings.h index 9eb2254f..0b828e2a 100644 --- a/src/settings.h +++ b/src/settings.h @@ -425,8 +425,6 @@ public: n = m_defaults.find(name); if(n == NULL) { - infostream<<"Settings: Setting not found: \"" - <