mirror of
https://github.com/glest/glest-source.git
synced 2025-09-26 07:28:59 +02:00
Changed the logging system to be more flexible and to support world synch logging
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "streflop_cond.h"
|
||||
//#include <cmath>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
namespace Shared{ namespace Graphics{
|
||||
|
||||
@@ -133,6 +135,12 @@ public:
|
||||
x/= m;
|
||||
y/= m;
|
||||
}
|
||||
|
||||
std::string getString() {
|
||||
std::ostringstream streamOut;
|
||||
streamOut << "x [" << x << "] y [" << y << "]";
|
||||
return streamOut.str();
|
||||
}
|
||||
};
|
||||
|
||||
typedef Vec2<int> Vec2i;
|
||||
@@ -298,6 +306,12 @@ public:
|
||||
return rv;
|
||||
}
|
||||
|
||||
std::string getString() {
|
||||
std::ostringstream streamOut;
|
||||
streamOut << "x [" << x << "] y [" << y << "] z [" << z << "]";
|
||||
return streamOut.str();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef Vec3<int> Vec3i;
|
||||
@@ -431,6 +445,13 @@ public:
|
||||
T dot(const Vec4<T> &v) const{
|
||||
return x*v.x + y*v.y + z*v.z + w*v.w;
|
||||
}
|
||||
|
||||
std::string getString() {
|
||||
std::ostringstream streamOut;
|
||||
streamOut << "x [" << x << "] y [" << y << "] z [" << z << "] w [" << w << "]";
|
||||
return streamOut.str();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef Vec4<int> Vec4i;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
|
||||
using std::string;
|
||||
|
||||
@@ -21,28 +22,60 @@ namespace Shared{ namespace Util{
|
||||
|
||||
class SystemFlags
|
||||
{
|
||||
public:
|
||||
|
||||
enum DebugType {
|
||||
debugSystem,
|
||||
debugNetwork,
|
||||
debugPerformance,
|
||||
debugWorldSynch
|
||||
};
|
||||
|
||||
class SystemFlagsType
|
||||
{
|
||||
protected:
|
||||
DebugType debugType;
|
||||
|
||||
public:
|
||||
SystemFlagsType() {
|
||||
this->debugType = debugSystem;
|
||||
this->enabled = false;
|
||||
this->fileStream = NULL;
|
||||
this->debugLogFileName = "";
|
||||
}
|
||||
SystemFlagsType(DebugType debugType) {
|
||||
this->debugType = debugType;
|
||||
this->enabled = false;
|
||||
this->fileStream = NULL;
|
||||
this->debugLogFileName = "";
|
||||
}
|
||||
SystemFlagsType(DebugType debugType,bool enabled,
|
||||
std::ofstream *fileStream,std::string debugLogFileName) {
|
||||
this->debugType = debugType;
|
||||
this->enabled = enabled;
|
||||
this->fileStream = fileStream;
|
||||
this->debugLogFileName = debugLogFileName;
|
||||
}
|
||||
|
||||
bool enabled;
|
||||
std::ofstream *fileStream;
|
||||
std::string debugLogFileName;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
static int lockFile;
|
||||
static string lockfilename;
|
||||
|
||||
static std::ofstream fileStream;
|
||||
static std::map<DebugType,SystemFlagsType> debugLogFileList;
|
||||
|
||||
public:
|
||||
|
||||
SystemFlags();
|
||||
~SystemFlags();
|
||||
|
||||
enum DebugType {
|
||||
debugSystem,
|
||||
debugNetwork,
|
||||
debugPerformance
|
||||
};
|
||||
|
||||
static bool enableDebugText;
|
||||
static bool enableNetworkDebugInfo;
|
||||
static bool enablePerformanceDebugInfo;
|
||||
static const char *debugLogFile;
|
||||
|
||||
static void init();
|
||||
static SystemFlagsType & getSystemSettingType(DebugType type) { return debugLogFileList[type]; }
|
||||
static void OutputDebug(DebugType type, const char *fmt, ...);
|
||||
static void Close();
|
||||
};
|
||||
|
Reference in New Issue
Block a user