Erwan
-missing files (JLogger)
This commit is contained in:
19
JGE/include/JLogger.h
Normal file
19
JGE/include/JLogger.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _JLOGGER_H_
|
||||
#define _JLOGGER_H_
|
||||
//logging facility
|
||||
//#define DOJLOG
|
||||
|
||||
#ifdef DOJLOG
|
||||
#define JLOG(x) JLogger::Log(x);
|
||||
#else
|
||||
#define JLOG(x) {};
|
||||
#endif
|
||||
|
||||
#define JGE_LOG_FILE "jge_debug.txt"
|
||||
|
||||
class JLogger{
|
||||
public:
|
||||
static void Log(const char * text);
|
||||
};
|
||||
|
||||
#endif
|
||||
25
JGE/src/JLogger.cpp
Normal file
25
JGE/src/JLogger.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "../include/JLogger.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
#if defined (WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
void JLogger::Log(const char * text){
|
||||
ofstream file (JGE_LOG_FILE,ios_base::app);
|
||||
if (file){
|
||||
file << text;
|
||||
file << "\n";
|
||||
file.close();
|
||||
}
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString(text);
|
||||
OutputDebugString("\n");
|
||||
#else
|
||||
printf(text);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user