Added logging for server using syslog.

This commit is contained in:
lotodore
2007-10-23 21:26:07 +00:00
parent ae030a3669
commit b4848532f9
12 changed files with 175 additions and 111 deletions
+8 -1
View File
@@ -21,6 +21,7 @@
#include "localexception.h"
#include "engine_msg.h"
#include <core/loghelper.h>
using namespace std;
@@ -61,6 +62,12 @@ LocalBeRo::~LocalBeRo()
{
}
int LocalBeRo::getHighestCardsValue() const
{
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): getHighestCardsValue() in wrong BeRo");
return 0;
}
void LocalBeRo::nextPlayer() {
PlayerListConstIterator currentPlayersTurnConstIt = myHand->getRunningPlayerIt(currentPlayersTurnId);
@@ -137,7 +144,7 @@ void LocalBeRo::run() {
break;
case GAME_STATE_RIVER: myHand->getGuiInterface()->logDealBoardCardsMsg(myBeRoID, tempBoardCardsArray[0], tempBoardCardsArray[1], tempBoardCardsArray[2], tempBoardCardsArray[3], tempBoardCardsArray[4]);
break;
default: { cout << "ERROR in localbero.cpp - wrong myBeRoID" << endl;}
default: { LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong myBeRoID"); }
}
logBoardCardsDone = true;
+1 -2
View File
@@ -21,7 +21,6 @@
#define LOCALBERO_H
#include <iostream>
#include "game_defs.h"
#include "berointerface.h"
@@ -34,7 +33,7 @@ public:
GameState getMyBeRoID() const { return myBeRoID; }
int getHighestCardsValue() const { std::cout << "getHighestCardsValue() in wrong BeRo" << std::endl; return 0; }
int getHighestCardsValue() const;
void setHighestCardsValue(int /*theValue*/) { }
void setMinimumRaise ( int theValue ) { minimumRaise = theValue; }
+2 -1
View File
@@ -21,6 +21,7 @@
#include "handinterface.h"
#include <game_defs.h>
#include <core/loghelper.h>
#include "localexception.h"
#include "engine_msg.h"
@@ -214,7 +215,7 @@ void LocalBoard::distributePot() {
// ERROR-Outputs
if(pot!=0) cout << "distributePot-ERROR: Pot = " << pot << endl;
if(pot!=0) LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: Pot = " << pot);
int sum = 0;
+3 -2
View File
@@ -21,6 +21,7 @@
#include "tools.h"
#include "cardsvalue.h"
#include <game_defs.h>
#include <core/loghelper.h>
#include "localexception.h"
#include "engine_msg.h"
@@ -79,7 +80,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// error-check
for(j=0; j<5; j++) {
if (bestHandPos[j] == -1) {
cout << "ERROR getMyBestHandPosition in localhand.cpp" << endl;
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR getMyBestHandPosition");
}
}
@@ -336,7 +337,7 @@ void LocalHand::start() {
if(it_sB != getActivePlayerList()->end() && it_bB != getActivePlayerList()->end()) {
myGui->logNewBlindsSetsMsg((*it_sB)->getMySet(), (*it_bB)->getMySet(), (*it_sB)->getMyName().c_str(), (*it_bB)->getMyName().c_str());
}
else { cout << "Log Error: cannot find sBID or bBID" << "\n"; }
else { LOG_ERROR(__FILE__ << " (" << __LINE__ << "): Log Error: cannot find sBID or bBID"); }
myGui->flushLogAtHand();
// deal cards
+8 -4
View File
@@ -22,8 +22,10 @@
#include "tools.h"
#include "cardsvalue.h"
#include <configfile.h>
#include <core/loghelper.h>
#include <fstream>
#include <sstream>
using namespace std;
@@ -3524,7 +3526,7 @@ void LocalPlayer::calcMyOdds() {
break;
}
}
if(myOdds == -1) cout << "ERROR myOdds - " << handCode << endl;
if (myOdds == -1) LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR myOdds - " << handCode);
}
break;
@@ -3559,8 +3561,10 @@ void LocalPlayer::calcMyOdds() {
}
}
if(myOdds == -1) {
cout << "ERROR" << endl;
for(i=0; i<5; i++) cout << tempArray[i] << " ";
ostringstream logger;
logger << "ERROR myOdds is -1: ";
for(i=0; i<5; i++) logger << tempArray[i] << " ";
LOG_ERROR(__FILE__ << " (" << __LINE__ << "): " << logger.str());
// cout << "\t" << handCode << "\t" << myID << endl;
} else {
// cout << myHoleCardsValue << endl;
@@ -3679,7 +3683,7 @@ void LocalPlayer::calcMyOdds() {
}
break;
default: cout <<"ERROR - wrong init of currentRound" << endl;
default: LOG_ERROR(__FILE__ << " (" << __LINE__ << "): ERROR - wrong init of currentRound");
}