remove configFile from Log
This commit is contained in:
+9
-7
@@ -29,19 +29,21 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Log::Log(ConfigFile *c) : myConfig(c), curGameID(0)
|
Log::Log(string logDirString, int logOnOffInt) : curGameID(0), logOnOff(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(SQLITE_LOG) {
|
||||||
|
|
||||||
// logging activated
|
// logging activated
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if(logOnOffInt) {
|
||||||
|
|
||||||
|
logOnOff = true;
|
||||||
|
|
||||||
DIR *logDir;
|
DIR *logDir;
|
||||||
logDir = opendir(myConfig->readConfigString("LogDir").c_str());
|
logDir = opendir(logDirString.c_str());
|
||||||
|
|
||||||
// check if logging path exist
|
// check if logging path exist
|
||||||
if(myConfig->readConfigString("LogDir") != "" && logDir) {
|
if(logDirString != "" && logDir) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
string sql;
|
string sql;
|
||||||
@@ -57,7 +59,7 @@ Log::Log(ConfigFile *c) : myConfig(c), curGameID(0)
|
|||||||
strftime(curDate,11,"%Y-%m-%d",z);
|
strftime(curDate,11,"%Y-%m-%d",z);
|
||||||
strftime(curTime,9,"%H:%M:%S",z);
|
strftime(curTime,9,"%H:%M:%S",z);
|
||||||
|
|
||||||
string mySqliteLogFileName = boost::lexical_cast<string>(myConfig->readConfigString("LogDir").c_str());
|
string mySqliteLogFileName = boost::lexical_cast<string>(logDirString.c_str());
|
||||||
mySqliteLogFileName += "pokerth-log-" + boost::lexical_cast<string>(curDateTime) + ".pdb";
|
mySqliteLogFileName += "pokerth-log-" + boost::lexical_cast<string>(curDateTime) + ".pdb";
|
||||||
|
|
||||||
// open sqlite-db
|
// open sqlite-db
|
||||||
@@ -163,7 +165,7 @@ Log::logNewGameMsg(int gameID, int startCash, int startSmallBlind, unsigned deal
|
|||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(SQLITE_LOG) {
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if(logOnOff) {
|
||||||
//if write logfiles is enabled
|
//if write logfiles is enabled
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
@@ -208,7 +210,7 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned
|
|||||||
|
|
||||||
if(SQLITE_LOG) {
|
if(SQLITE_LOG) {
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if(logOnOff) {
|
||||||
//if write logfiles is enabled
|
//if write logfiles is enabled
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|||||||
+3
-3
@@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
struct sqlite3;
|
struct sqlite3;
|
||||||
class ConfigFile;
|
|
||||||
class PlayerInterface;
|
class PlayerInterface;
|
||||||
|
|
||||||
typedef boost::shared_ptr<std::list<boost::shared_ptr<PlayerInterface> > > PlayerList;
|
typedef boost::shared_ptr<std::list<boost::shared_ptr<PlayerInterface> > > PlayerList;
|
||||||
@@ -35,7 +35,7 @@ class Log
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Log(ConfigFile *c);
|
Log(std::string logDirString, int logOnOffInt);
|
||||||
|
|
||||||
~Log();
|
~Log();
|
||||||
|
|
||||||
@@ -45,9 +45,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigFile *myConfig;
|
|
||||||
sqlite3 *mySqliteLogDb;
|
sqlite3 *mySqliteLogDb;
|
||||||
int curGameID;
|
int curGameID;
|
||||||
|
bool logOnOff;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -46,7 +46,7 @@ Session::Session(GuiInterface *g, ConfigFile *c)
|
|||||||
: currentGameNum(0), myGui(g), myConfig(c), myLog(0), myGameType(GAME_TYPE_NONE)
|
: currentGameNum(0), myGui(g), myConfig(c), myLog(0), myGameType(GAME_TYPE_NONE)
|
||||||
{
|
{
|
||||||
myQtToolsInterface = CreateQtToolsWrapper();
|
myQtToolsInterface = CreateQtToolsWrapper();
|
||||||
myLog = new Log(myConfig);
|
myLog = new Log(myConfig->readConfigString("LogDir"),myConfig->readConfigInt("LogOnOff"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,6 +56,8 @@ Session::~Session()
|
|||||||
terminateNetworkServer();
|
terminateNetworkServer();
|
||||||
delete myQtToolsInterface;
|
delete myQtToolsInterface;
|
||||||
myQtToolsInterface = 0;
|
myQtToolsInterface = 0;
|
||||||
|
delete myLog;
|
||||||
|
myLog = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::init()
|
bool Session::init()
|
||||||
|
|||||||
Reference in New Issue
Block a user