Simplify LOG macros

coverity_scan^2
Koncord 8 years ago
parent eedd40328a
commit e2522fa366

@ -132,13 +132,13 @@ void MasterClient::Update()
while (sRun) while (sRun)
{ {
if (response == "Created") if (response == "Created")
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server registered on the master server.", ""); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server registered on the master server.");
else if (response == "Accepted") else if (response == "Accepted")
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server updated information about himself on the master server.", ""); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server updated information about himself on the master server.");
else if (response == "bad request") else if (response == "bad request")
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Update rate is too low, and the master server has deleted information about" LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Update rate is too low, and the master server has deleted information about"
" the server. Trying low rate...", ""); " the server. Trying low rate...");
SetUpdateRate(timeout - step_rate); SetUpdateRate(timeout - step_rate);
update = false; update = false;
} }

@ -730,7 +730,7 @@ void Networking::newPlayer(RakNet::RakNetGUID guid)
} }
} }
LOG_APPEND(Log::LOG_WARN, "%s", "- Done"); LOG_APPEND(Log::LOG_WARN, "- Done");
} }
@ -799,7 +799,7 @@ int Networking::mainLoop()
break; break;
case ID_CONNECTION_REQUEST_ACCEPTED: // client to server case ID_CONNECTION_REQUEST_ACCEPTED: // client to server
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Our connection request has been accepted"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Our connection request has been accepted");
break; break;
} }
case ID_NEW_INCOMING_CONNECTION: case ID_NEW_INCOMING_CONNECTION:
@ -807,7 +807,7 @@ int Networking::mainLoop()
packet->systemAddress.ToString()); packet->systemAddress.ToString());
break; break;
case ID_NO_FREE_INCOMING_CONNECTIONS: case ID_NO_FREE_INCOMING_CONNECTIONS:
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "The server is full"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "The server is full");
break; break;
case ID_DISCONNECTION_NOTIFICATION: case ID_DISCONNECTION_NOTIFICATION:
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Client at %s has disconnected", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Client at %s has disconnected",

@ -61,12 +61,12 @@ void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const
void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept
{ {
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub"); LOG_MESSAGE(Log::LOG_WARN, "stub");
} }
void GUIFunctions::SetMapVisibilityAll(unsigned short targetPID, unsigned short state) noexcept void GUIFunctions::SetMapVisibilityAll(unsigned short targetPID, unsigned short state) noexcept
{ {
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub"); LOG_MESSAGE(Log::LOG_WARN, "stub");
} }
void GUIFunctions::SetConsoleAllow(unsigned short pid, char state) void GUIFunctions::SetConsoleAllow(unsigned short pid, char state)

@ -36,7 +36,7 @@ void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const cha
void ItemFunctions::UnequipItem(unsigned short pid, unsigned short slot) noexcept void ItemFunctions::UnequipItem(unsigned short pid, unsigned short slot) noexcept
{ {
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub"); LOG_MESSAGE(Log::LOG_WARN, "stub");
//ItemFunctions::EquipItem(pid, slot, "", 0); //ItemFunctions::EquipItem(pid, slot, "", 0);
} }
@ -74,7 +74,7 @@ void ItemFunctions::RemoveItem(unsigned short pid, const char* itemName, unsigne
} }
void ItemFunctions::GetItemCount(unsigned short pid, const char* itemName) noexcept void ItemFunctions::GetItemCount(unsigned short pid, const char* itemName) noexcept
{ {
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub"); LOG_MESSAGE(Log::LOG_WARN, "stub");
} }
const char *ItemFunctions::GetItemName(unsigned short pid, unsigned int i) noexcept const char *ItemFunctions::GetItemName(unsigned short pid, unsigned int i) noexcept

@ -212,7 +212,7 @@ int main(int argc, char *argv[])
if (RakNet::NonNumericHostString(addr.c_str())) if (RakNet::NonNumericHostString(addr.c_str()))
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "%s", "You cannot use non-numeric addresses for the server."); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "You cannot use non-numeric addresses for the server.");
return 1; return 1;
} }
@ -229,7 +229,7 @@ int main(int argc, char *argv[])
MasterClient *mclient; MasterClient *mclient;
if (masterEnabled) if (masterEnabled)
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sharing server query info to master enabled."); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sharing server query info to master enabled.");
string masterAddr = mgr.getString("address", "MasterServer"); string masterAddr = mgr.getString("address", "MasterServer");
int masterPort = mgr.getInt("port", "MasterServer"); int masterPort = mgr.getInt("port", "MasterServer");
mclient = new MasterClient(masterAddr, (unsigned short) masterPort, addr, (unsigned short) port); mclient = new MasterClient(masterAddr, (unsigned short) masterPort, addr, (unsigned short) port);
@ -251,7 +251,7 @@ int main(int argc, char *argv[])
} }
if (code == 0) if (code == 0)
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Quitting peacefully."); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Quitting peacefully.");
// Restore cout and cerr // Restore cout and cerr
std::cout.rdbuf(cout_rdbuf); std::cout.rdbuf(cout_rdbuf);

@ -108,7 +108,7 @@ namespace mwmp
setVisible(true); setVisible(true);
} }
mHistory->addText(color + MyGUI::TextIterator::toTagsString(msg)); mHistory->addText(color + MyGUI::TextIterator::toTagsString(msg));
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", msg.c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, msg.c_str());
} }
void GUIChat::printOK(const std::string &msg) void GUIChat::printOK(const std::string &msg)
@ -182,7 +182,7 @@ namespace mwmp
else // CHAT_ENABLED else // CHAT_ENABLED
editState = true; editState = true;
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "%s", "Opening chat."); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Opening chat.");
SetEditState(editState); SetEditState(editState);
} }

@ -121,7 +121,7 @@ bool LocalPlayer::charGenThread()
(*Npc()) = *player.get<ESM::NPC>()->mBase; (*Npc()) = *player.get<ESM::NPC>()->mBase;
(*BirthSign()) = world->getPlayer().getBirthSign(); (*BirthSign()) = world->getPlayer().getBirthSign();
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_BASE_INFO to server with my CharGen info"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_GAME_BASE_INFO to server with my CharGen info");
getNetworking()->getPlayerPacket(ID_GAME_BASE_INFO)->Send(this); getNetworking()->getPlayerPacket(ID_GAME_BASE_INFO)->Send(this);
// Send stats packets if this is the 2nd round of CharGen that // Send stats packets if this is the 2nd round of CharGen that
@ -333,7 +333,7 @@ void LocalPlayer::updateCell(bool forceUpdate)
if (cellChanged) if (cellChanged)
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_CELL to server"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_GAME_CELL to server");
LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s", LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s",
getCell()->getDescription().c_str(), getCell()->getDescription().c_str(),

@ -60,7 +60,7 @@ std::string loadSettings (Settings::Manager & settings)
Main::Main() Main::Main()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "tes3mp started"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "tes3mp started");
mNetworking = new Networking(); mNetworking = new Networking();
mLocalPlayer = new LocalPlayer(); mLocalPlayer = new LocalPlayer();
mGUIController = new GUIController(); mGUIController = new GUIController();
@ -73,7 +73,7 @@ Main::Main()
Main::~Main() Main::~Main()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "tes3mp stopped"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "tes3mp stopped");
delete mNetworking; delete mNetworking;
delete mLocalPlayer; delete mLocalPlayer;
Players::cleanUp(); Players::cleanUp();
@ -184,7 +184,7 @@ void Main::updateWorld(float dt) const
if (init) if (init)
{ {
init = false; init = false;
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_BASE_INFO to server"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_GAME_BASE_INFO to server");
mNetworking->getPlayerPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer()); mNetworking->getPlayerPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer());
mNetworking->getPlayerPacket(ID_LOADED)->Send(getLocalPlayer()); mNetworking->getPlayerPacket(ID_LOADED)->Send(getLocalPlayer());

@ -63,19 +63,19 @@ void Networking::update()
switch (packet->data[0]) switch (packet->data[0])
{ {
case ID_REMOTE_DISCONNECTION_NOTIFICATION: case ID_REMOTE_DISCONNECTION_NOTIFICATION:
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has disconnected."); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Another client has disconnected.");
break; break;
case ID_REMOTE_CONNECTION_LOST: case ID_REMOTE_CONNECTION_LOST:
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has lost connection."); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Another client has lost connection.");
break; break;
case ID_REMOTE_NEW_INCOMING_CONNECTION: case ID_REMOTE_NEW_INCOMING_CONNECTION:
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Another client has connected."); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Another client has connected.");
break; break;
case ID_CONNECTION_REQUEST_ACCEPTED: case ID_CONNECTION_REQUEST_ACCEPTED:
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Our connection request has been accepted."); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Our connection request has been accepted.");
break; break;
case ID_NEW_INCOMING_CONNECTION: case ID_NEW_INCOMING_CONNECTION:
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "A connection is incoming."); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "A connection is incoming.");
break; break;
case ID_NO_FREE_INCOMING_CONNECTIONS: case ID_NO_FREE_INCOMING_CONNECTIONS:
errmsg = "The server is full."; errmsg = "The server is full.";
@ -95,7 +95,7 @@ void Networking::update()
if (!errmsg.empty()) if (!errmsg.empty())
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "%s", errmsg.c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, errmsg.c_str());
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "tes3mp", errmsg.c_str(), 0); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "tes3mp", errmsg.c_str(), 0);
MWBase::Environment::get().getStateManager()->requestQuit(); MWBase::Environment::get().getStateManager()->requestQuit();
} }
@ -167,7 +167,7 @@ void Networking::connect(const std::string &ip, unsigned short port)
if (!errmsg.empty()) if (!errmsg.empty())
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "%s", errmsg.c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, errmsg.c_str());
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "tes3mp", errmsg.c_str(), 0); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "tes3mp", errmsg.c_str(), 0);
MWBase::Environment::get().getStateManager()->requestQuit(); MWBase::Environment::get().getStateManager()->requestQuit();
} }
@ -196,21 +196,21 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
} }
case ID_GAME_BASE_INFO: case ID_GAME_BASE_INFO:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Received ID_GAME_BASE_INFO from server"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_BASE_INFO from server");
if (guid == myGuid) if (guid == myGuid)
{ {
LOG_APPEND(Log::LOG_INFO, "%s", "- Packet was about my id"); LOG_APPEND(Log::LOG_INFO, "- Packet was about my id");
if (packet->length == myPacket->headerSize()) if (packet->length == myPacket->headerSize())
{ {
LOG_APPEND(Log::LOG_INFO, "%s", "- Requesting info"); LOG_APPEND(Log::LOG_INFO, "- Requesting info");
myPacket->Send(getLocalPlayer(), serverAddr); myPacket->Send(getLocalPlayer(), serverAddr);
} }
else else
{ {
myPacket->Packet(&bsIn, getLocalPlayer(), false); myPacket->Packet(&bsIn, getLocalPlayer(), false);
LOG_APPEND(Log::LOG_INFO, "%s", "- Updating LocalPlayer"); LOG_APPEND(Log::LOG_INFO, "- Updating LocalPlayer");
getLocalPlayer()->updateChar(); getLocalPlayer()->updateChar();
} }
} }
@ -220,7 +220,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (pl == 0) if (pl == 0)
{ {
LOG_APPEND(Log::LOG_INFO, "%s", "- Exchanging data with new player"); LOG_APPEND(Log::LOG_INFO, "- Exchanging data with new player");
pl = Players::newPlayer(guid); pl = Players::newPlayer(guid);
} }
@ -235,7 +235,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{ {
if (packet->length != myPacket->headerSize()) if (packet->length != myPacket->headerSize())
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "ID_GAME_POS changed by server"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GAME_POS changed by server");
myPacket->Packet(&bsIn, getLocalPlayer(), false); myPacket->Packet(&bsIn, getLocalPlayer(), false);
getLocalPlayer()->setPosition(); getLocalPlayer()->setPosition();
} }
@ -251,7 +251,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
} }
case ID_USER_MYID: case ID_USER_MYID:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Received ID_USER_MYID from server"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_USER_MYID from server");
myGuid = guid; myGuid = guid;
getLocalPlayer()->guid = guid; getLocalPlayer()->guid = guid;
break; break;
@ -434,7 +434,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
} }
case ID_GAME_DIE: case ID_GAME_DIE:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Received ID_GAME_DIE from server"); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_DIE from server");
if (guid == myGuid) if (guid == myGuid)
{ {
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
@ -710,7 +710,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_PLACE"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_PLACE");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- count: %i", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- count: %i",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -743,7 +743,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_DELETE"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_DELETE");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -768,7 +768,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_LOCK"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_LOCK");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -793,7 +793,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_UNLOCK"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_UNLOCK");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -843,7 +843,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_MOVE"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_MOVE");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -869,7 +869,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_ROTATE"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ROTATE");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -895,7 +895,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_ANIM_PLAY"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -921,7 +921,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_DOOR_ACTIVATE"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_ACTIVATE");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -943,7 +943,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
} }
case ID_VIDEO_PLAY: case ID_VIDEO_PLAY:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_VIDEO_PLAY"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_VIDEO_PLAY");
LOG_APPEND(Log::LOG_WARN, "- video: %s\n- allowSkipping: %s", LOG_APPEND(Log::LOG_WARN, "- video: %s\n- allowSkipping: %s",
event->video.c_str(), event->video.c_str(),
event->allowSkipping ? "true" : "false"); event->allowSkipping ? "true" : "false");
@ -958,7 +958,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_SCRIPT_LOCAL_SHORT"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_SHORT");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -985,7 +985,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (!ptrCellStore) return; if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_SCRIPT_LOCAL_FLOAT"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_FLOAT");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex, event->cellRef.mRefNum.mIndex,
@ -1008,7 +1008,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
} }
case ID_SCRIPT_MEMBER_SHORT: case ID_SCRIPT_MEMBER_SHORT:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_SCRIPT_MEMBER_SHORT"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_MEMBER_SHORT");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s\n- index: %i\n- shortVal: %i\n", LOG_APPEND(Log::LOG_WARN, "- cellRef: %s\n- index: %i\n- shortVal: %i\n",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->index, event->index,
@ -1035,7 +1035,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
} }
case ID_SCRIPT_GLOBAL_SHORT: case ID_SCRIPT_GLOBAL_SHORT:
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_SCRIPT_GLOBAL_SHORT"); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_GLOBAL_SHORT");
LOG_APPEND(Log::LOG_WARN, "- varName: %s\n- shortVal: %i", LOG_APPEND(Log::LOG_WARN, "- varName: %s\n- shortVal: %i",
event->varName.c_str(), event->varName.c_str(),
event->shortVal); event->shortVal);

@ -5,6 +5,10 @@
#ifndef OPENMW_LOG_HPP #ifndef OPENMW_LOG_HPP
#define OPENMW_LOG_HPP #define OPENMW_LOG_HPP
#ifdef __GNUC__
#pragma GCC system_header
#endif
#if defined(NOLOGS) #if defined(NOLOGS)
#define LOG_INIT(logLevel) #define LOG_INIT(logLevel)
#define LOG_QUIT() #define LOG_QUIT()
@ -13,9 +17,9 @@
#else #else
#define LOG_INIT(logLevel) Log::Create(logLevel) #define LOG_INIT(logLevel) Log::Create(logLevel)
#define LOG_QUIT() Log::Delete() #define LOG_QUIT() Log::Delete()
#define LOG_MESSAGE(level, msg, ...) Log::Get().print((level), (1), (__FILE__), (__LINE__), (msg), __VA_ARGS__) #define LOG_MESSAGE(level, msg, args...) Log::Get().print((level), (1), (__FILE__), (__LINE__), (msg), ##args)
#define LOG_MESSAGE_SIMPLE(level, msg, ...) Log::Get().print((level), (1), (0), (0), (msg), __VA_ARGS__) #define LOG_MESSAGE_SIMPLE(level, msg, args...) Log::Get().print((level), (1), (0), (0), (msg), ##args)
#define LOG_APPEND(level, msg, ...) Log::Get().print((level), (0), (0), (0), (msg), __VA_ARGS__) #define LOG_APPEND(level, msg, args...) Log::Get().print((level), (0), (0), (0), (msg), ##args)
#endif #endif
class Log class Log

Loading…
Cancel
Save