mirror of
https://github.com/glest/glest-source.git
synced 2025-08-30 11:19:48 +02:00
Some bugfixing for logfile saving after testing in win32
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#define _SHARED_UTIL_UTIL_H_
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
using std::string;
|
||||
|
||||
@@ -20,6 +21,9 @@ namespace Shared{ namespace Util{
|
||||
|
||||
class SystemFlags
|
||||
{
|
||||
protected:
|
||||
|
||||
static std::ofstream fileStream;
|
||||
public:
|
||||
|
||||
enum DebugType {
|
||||
@@ -32,6 +36,7 @@ public:
|
||||
static const char *debugLogFile;
|
||||
|
||||
static void OutputDebug(DebugType type, const char *fmt, ...);
|
||||
static void Close();
|
||||
};
|
||||
|
||||
const string sharedLibVersionString= "v0.4.1";
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <stdarg.h>
|
||||
#include <fstream>
|
||||
|
||||
#include "leak_dumper.h"
|
||||
|
||||
@@ -25,10 +24,16 @@ using namespace std;
|
||||
|
||||
namespace Shared{ namespace Util{
|
||||
|
||||
|
||||
bool SystemFlags::enableDebugText = false;
|
||||
bool SystemFlags::enableNetworkDebugInfo = false;
|
||||
const char * SystemFlags::debugLogFile = NULL;
|
||||
ofstream SystemFlags::fileStream;
|
||||
|
||||
void SystemFlags::Close() {
|
||||
if(fileStream.is_open() == true) {
|
||||
SystemFlags::fileStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
void SystemFlags::OutputDebug(DebugType type, const char *fmt, ...) {
|
||||
if((type == debugSystem && SystemFlags::enableDebugText == false) ||
|
||||
@@ -41,7 +46,6 @@ void SystemFlags::OutputDebug(DebugType type, const char *fmt, ...) {
|
||||
|
||||
// Either output to a logfile or
|
||||
if(SystemFlags::debugLogFile != NULL && SystemFlags::debugLogFile[0] != 0) {
|
||||
static ofstream fileStream;
|
||||
if(fileStream.is_open() == false) {
|
||||
printf("Opening logfile [%s]\n",SystemFlags::debugLogFile);
|
||||
fileStream.open(SystemFlags::debugLogFile, ios_base::out | ios_base::trunc);
|
||||
|
Reference in New Issue
Block a user