Browse Source

Tab2Space & Newlines

peercoin
Intel 12 years ago
parent
commit
57c65a4ba2
  1. 2
      src/server/poolserver/Database/ServerDatabaseEnv.cpp
  2. 2
      src/server/poolserver/Database/ServerDatabaseEnv.h
  3. 76
      src/server/poolserver/Main.cpp
  4. 18
      src/server/poolserver/Server/Server.cpp
  5. 24
      src/server/shared/Configuration/Config.h
  6. 16
      src/server/shared/Database/Database.h
  7. 2
      src/server/shared/Database/DatabaseCallback.h
  8. 2
      src/server/shared/Database/DatabaseEnv.h
  9. 2
      src/server/shared/Database/Field.h
  10. 2
      src/server/shared/Database/MySQL/DatabaseConnectionMySQL.cpp
  11. 14
      src/server/shared/Database/MySQL/DatabaseConnectionMySQL.h
  12. 2
      src/server/shared/Database/MySQL/DatabaseEnvMySQL.h
  13. 2
      src/server/shared/Database/MySQL/DatabaseOperationMySQL.cpp
  14. 2
      src/server/shared/Database/MySQL/DatabaseOperationMySQL.h
  15. 2
      src/server/shared/Database/MySQL/DatabaseWorkerMySQL.h
  16. 16
      src/server/shared/Database/MySQL/DatabaseWorkerPoolMySQL.h
  17. 2
      src/server/shared/Database/MySQL/FieldMySQL.h
  18. 2
      src/server/shared/Database/MySQL/PreparedStatementMySQL.cpp
  19. 2
      src/server/shared/Database/MySQL/PreparedStatementMySQL.h
  20. 2
      src/server/shared/Database/MySQL/QueryResultMySQL.h
  21. 2
      src/server/shared/Database/PreparedStatement.h
  22. 2
      src/server/shared/Database/QueryResult.h
  23. 118
      src/server/shared/Logging/Log.cpp
  24. 46
      src/server/shared/Logging/Log.h
  25. 2
      src/server/shared/Util.cpp
  26. 2
      src/server/shared/Util.h

2
src/server/poolserver/Database/ServerDatabaseEnv.cpp

@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
#include "ServerDatabaseEnv.h"
ServerDatabaseWorkerPoolMySQL sDatabase;
ServerDatabaseWorkerPoolMySQL sDatabase;

2
src/server/poolserver/Database/ServerDatabaseEnv.h

@ -9,4 +9,4 @@ class ServerDatabaseWorkerPoolMySQL : public DatabaseWorkerPoolMySQL @@ -9,4 +9,4 @@ class ServerDatabaseWorkerPoolMySQL : public DatabaseWorkerPoolMySQL
extern ServerDatabaseWorkerPoolMySQL sDatabase;
#endif
#endif

76
src/server/poolserver/Main.cpp

@ -9,41 +9,41 @@ bool InitConfig(int argc, char *argv[]) @@ -9,41 +9,41 @@ bool InitConfig(int argc, char *argv[])
{
// Containers
boost::program_options::options_description descGeneric("Generic Options");
boost::program_options::options_description descServer("Server Configuration");
boost::program_options::options_description descStratum("Stratum Configuration");
boost::program_options::options_description descLogging("Logging Configuration");
boost::program_options::options_description descServer("Server Configuration");
boost::program_options::options_description descStratum("Stratum Configuration");
boost::program_options::options_description descLogging("Logging Configuration");
boost::program_options::options_description descDatabase("Database Configuration");
#ifdef WITH_MYSQL
boost::program_options::options_description descMySQL("MySQL Configuration");
#endif
boost::program_options::options_description cmdlineOptions;
boost::program_options::options_description fileOptions;
boost::program_options::options_description cmdlineOptions;
boost::program_options::options_description fileOptions;
// Generic
descGeneric.add_options()
("version,v", "print version string")
("help,h", "produce help message")
("config,c", boost::program_options::value<std::string>()->default_value("poolserver.cfg"),"name of a file of a configuration.")
("version,v", "print version string")
("help,h", "produce help message")
("config,c", boost::program_options::value<std::string>()->default_value("poolserver.cfg"),"name of a file of a configuration.")
;
// Server
// Server
descServer.add_options()
("MinDiffTime", boost::program_options::value<uint32_t>()->default_value(100), "Minimum server diff time")
;
// Stratum
// Stratum
descStratum.add_options()
("StratumHost,sh", boost::program_options::value<std::string>()->default_value("0.0.0.0"), "Stratum server host")
("StratumPort,sp", boost::program_options::value<uint16_t>()->default_value(3333), "Stratum server port")
("StratumPort,sp", boost::program_options::value<uint16_t>()->default_value(3333), "Stratum server port")
;
// Logging
descLogging.add_options()
// Logging
descLogging.add_options()
("LogConsoleLevel", boost::program_options::value<uint32_t>()->default_value(LOG_LEVEL_INFO), "Console log level (0-None, 1-Error, 2-Warn, 3-Info, 4-Debug)")
("LogConsoleDebugMask", boost::program_options::value<uint32_t>()->default_value(0), "Console log debug mask")
("LogFilePath", boost::program_options::value<std::string>()->default_value("."), "File log path")
("LogFileLevel", boost::program_options::value<uint32_t>()->default_value(LOG_LEVEL_WARN), "File log level (0-None, 1-Error, 2-Warn, 3-Info, 4-Debug)")
("LogFileDebugMask", boost::program_options::value<uint32_t>()->default_value(0), "File log debug mask")
("LogConsoleDebugMask", boost::program_options::value<uint32_t>()->default_value(0), "Console log debug mask")
("LogFilePath", boost::program_options::value<std::string>()->default_value("."), "File log path")
("LogFileLevel", boost::program_options::value<uint32_t>()->default_value(LOG_LEVEL_WARN), "File log level (0-None, 1-Error, 2-Warn, 3-Info, 4-Debug)")
("LogFileDebugMask", boost::program_options::value<uint32_t>()->default_value(0), "File log debug mask")
;
// Database
@ -62,39 +62,39 @@ bool InitConfig(int argc, char *argv[]) @@ -62,39 +62,39 @@ bool InitConfig(int argc, char *argv[])
;
descDatabase.add(descMySQL);
#endif
cmdlineOptions.add(descGeneric).add(descServer).add(descStratum).add(descLogging).add(descDatabase);
fileOptions.add(descServer).add(descStratum).add(descLogging).add(descDatabase);
store(boost::program_options::command_line_parser(argc, argv).options(cmdlineOptions).run(), sConfig.vm);
notify(sConfig.vm);
if (sConfig.vm.count("help")) {
std::cout << cmdlineOptions << std::endl;
return false;
}
if (sConfig.vm.count("help")) {
std::cout << cmdlineOptions << std::endl;
return false;
}
std::ifstream ifs(sConfig.Get<std::string>("config").c_str());
if (!ifs.is_open()) {
if (!ifs.is_open()) {
sLog.Error(LOG_GENERAL, "Failed opening config file: %s", sConfig.Get<std::string>("config").c_str());
return false;
}
return false;
}
store(parse_config_file(ifs, fileOptions), sConfig.vm);
notify(sConfig.vm);
store(parse_config_file(ifs, fileOptions), sConfig.vm);
notify(sConfig.vm);
return true;
}
int main(int argc, char *argv[])
{
if (!InitConfig(argc, argv))
return 0;
sLog.OpenLogFile(sConfig.Get<std::string>("LogFilePath"));
sLog.Info(LOG_GENERAL, "LogFile Started: %s", sLog.logFileLoc.c_str());
if (!InitConfig(argc, argv))
return 0;
sLog.OpenLogFile(sConfig.Get<std::string>("LogFilePath"));
sLog.Info(LOG_GENERAL, "LogFile Started: %s", sLog.logFileLoc.c_str());
Server* server = new Server();
int exitcode = server->Run();
delete server;

18
src/server/poolserver/Server/Server.cpp

@ -19,27 +19,27 @@ Server::~Server() @@ -19,27 +19,27 @@ Server::~Server()
int Server::Run()
{
sLog.Info(LOG_SERVER, "Server is starting...");
sLog.Info(LOG_SERVER, "Server is starting...");
InitDatabase();
sDatabase.Execute("INSERT INTO `test_table` VALUES ('999', 'sync', '1.1')");
sDatabase.ExecuteAsync("INSERT INTO `test_table` VALUES ('999', 'sync', '1.1')");
// Start stratum server
sLog.Info(LOG_SERVER, "Starting stratum");
sLog.Info(LOG_SERVER, "Starting stratum");
//stratumServer = new Stratum::Server(Config::GetString("STRATUM_IP"), Config::GetInt("STRATUM_PORT"));
// Init loop vars
uint32_t sleepDuration = 0;
int exitcode = 0;
running = true;
// Init diff
uint32_t minDiffTime = sConfig.Get<uint32_t>("MinDiffTime");
uint32_t minDiffTime = sConfig.Get<uint32_t>("MinDiffTime");
diffStart = boost::chrono::steady_clock::now();
sLog.Info(LOG_SERVER, "Server is running!");
sLog.Info(LOG_SERVER, "Server is running!");
while (running)
{
@ -60,8 +60,8 @@ int Server::Run() @@ -60,8 +60,8 @@ int Server::Run()
++serverLoops;
if (serverLoops > 50)
running = false;
if (serverLoops > 50)
running = false;
//std::cout << "Diff: " << diff << ", Loop: " << serverLoops << std::endl;
}

24
src/server/shared/Configuration/Config.h

@ -9,18 +9,18 @@ @@ -9,18 +9,18 @@
class Config
{
public:
Config();
~Config();
// Reading
template<class T>
T Get(std::string key)
{
return vm[key].as<T>();
}
// Containers
boost::program_options::variables_map vm;
Config();
~Config();
// Reading
template<class T>
T Get(std::string key)
{
return vm[key].as<T>();
}
// Containers
boost::program_options::variables_map vm;
};
extern Config sConfig;

16
src/server/shared/Database/Database.h

@ -9,22 +9,22 @@ @@ -9,22 +9,22 @@
class Database
{
public:
// Queries
virtual bool Execute(const char* query) = 0;
virtual ResultSet* Query(const char* query) = 0;
// Queries
virtual bool Execute(const char* query) = 0;
virtual ResultSet* Query(const char* query) = 0;
// Stmt
virtual bool Execute(PreparedStatement* stmt) = 0;
virtual ResultSet* Query(PreparedStatement* stmt) = 0;
virtual ResultSet* Query(PreparedStatement* stmt) = 0;
// Async
virtual bool ExecuteAsync(const char* query) = 0;
virtual bool ExecuteAsync(PreparedStatement* stmt) = 0;
virtual bool QueryAsync(DatabaseCallback callback, const char* query) = 0;
virtual bool QueryAsync(DatabaseCallback callback, PreparedStatement* stmt) = 0;
virtual bool QueryAsync(DatabaseCallback callback, const char* query) = 0;
virtual bool QueryAsync(DatabaseCallback callback, PreparedStatement* stmt) = 0;
// Prepared Statements
virtual PreparedStatement* GetPreparedStatement(uint32_t index) = 0;
// Prepared Statements
virtual PreparedStatement* GetPreparedStatement(uint32_t index) = 0;
};
#endif

2
src/server/shared/Database/DatabaseCallback.h

@ -7,4 +7,4 @@ @@ -7,4 +7,4 @@
typedef boost::function<void(ResultSet*)> DatabaseCallback;
#endif
#endif

2
src/server/shared/Database/DatabaseEnv.h

@ -7,4 +7,4 @@ @@ -7,4 +7,4 @@
#include "MySQL/DatabaseEnvMySQL.h"
#endif
#endif
#endif

2
src/server/shared/Database/Field.h

@ -8,4 +8,4 @@ public: @@ -8,4 +8,4 @@ public:
//virtual Get();
};
#endif
#endif

2
src/server/shared/Database/MySQL/DatabaseConnectionMySQL.cpp

@ -146,4 +146,4 @@ ResultSetMySQL* DatabaseConnectionMySQL::Query(PreparedStatement* stmt) @@ -146,4 +146,4 @@ ResultSetMySQL* DatabaseConnectionMySQL::Query(PreparedStatement* stmt)
bool DatabaseConnectionMySQL::_HandleMySQLErrno(uint32_t lErrno)
{
return false;
}
}

14
src/server/shared/Database/MySQL/DatabaseConnectionMySQL.h

@ -35,18 +35,18 @@ public: @@ -35,18 +35,18 @@ public:
void Close();
// Ping!
void Ping()
void Ping()
{
mysql_ping(_mysql);
}
// Queries
bool Execute(const char* query);
ResultSetMySQL* Query(const char* query);
// Queries
bool Execute(const char* query);
ResultSetMySQL* Query(const char* query);
// Stmt
bool Execute(PreparedStatement* stmt);
ResultSetMySQL* Query(PreparedStatement* stmt);
ResultSetMySQL* Query(PreparedStatement* stmt);
// Locking
bool LockIfReady()
@ -76,4 +76,4 @@ private: @@ -76,4 +76,4 @@ private:
MySQLConnectionInfo _connectionInfo;
};
#endif
#endif

2
src/server/shared/Database/MySQL/DatabaseEnvMySQL.h

@ -3,4 +3,4 @@ @@ -3,4 +3,4 @@
#include "DatabaseWorkerPoolMySQL.h"
#endif
#endif

2
src/server/shared/Database/MySQL/DatabaseOperationMySQL.cpp

@ -23,4 +23,4 @@ void DatabaseQueryOperationMySQL::Execute() @@ -23,4 +23,4 @@ void DatabaseQueryOperationMySQL::Execute()
_callback(result);
} else
_conn->Execute(_query);
}
}

2
src/server/shared/Database/MySQL/DatabaseOperationMySQL.h

@ -49,4 +49,4 @@ private: @@ -49,4 +49,4 @@ private:
typedef Util::SynchronisedQueue<DatabaseOperationMySQL*> DatabaseWorkQueueMySQL;
#endif
#endif

2
src/server/shared/Database/MySQL/DatabaseWorkerMySQL.h

@ -16,4 +16,4 @@ private: @@ -16,4 +16,4 @@ private:
DatabaseConnectionMySQL* _conn;
};
#endif
#endif

16
src/server/shared/Database/MySQL/DatabaseWorkerPoolMySQL.h

@ -69,14 +69,14 @@ public: @@ -69,14 +69,14 @@ public:
}
// Queries
bool Execute(const char* query)
bool Execute(const char* query)
{
DatabaseConnectionMySQL* conn = GetSyncConnection();
bool result = conn->Execute(query);
conn->Unlock();
return result;
}
ResultSetMySQL* Query(const char* query)
ResultSetMySQL* Query(const char* query)
{
DatabaseConnectionMySQL* conn = GetSyncConnection();
ResultSetMySQL* result = conn->Query(query);
@ -92,7 +92,7 @@ public: @@ -92,7 +92,7 @@ public:
conn->Unlock();
return result;
}
ResultSetMySQL* Query(PreparedStatement* stmt)
ResultSetMySQL* Query(PreparedStatement* stmt)
{
DatabaseConnectionMySQL* conn = GetSyncConnection();
ResultSetMySQL* result = conn->Query(stmt);
@ -113,21 +113,21 @@ public: @@ -113,21 +113,21 @@ public:
_asyncQueue->Enqueue(op);
return true;
}
bool QueryAsync(DatabaseCallback callback, const char* query)
bool QueryAsync(DatabaseCallback callback, const char* query)
{
DatabaseQueryOperationMySQL* op = new DatabaseQueryOperationMySQL(query, callback);
_asyncQueue->Enqueue(op);
return true;
}
bool QueryAsync(DatabaseCallback callback, PreparedStatement* stmt)
bool QueryAsync(DatabaseCallback callback, PreparedStatement* stmt)
{
DatabasePreparedStatementOperationMySQL* op = new DatabasePreparedStatementOperationMySQL(stmt, callback);
_asyncQueue->Enqueue(op);
return true;
}
// Prepared Statements
PreparedStatement* GetPreparedStatement(uint32_t stmtid)
// Prepared Statements
PreparedStatement* GetPreparedStatement(uint32_t stmtid)
{
return NULL;//new PreparedStatement(stmtid);
}
@ -155,4 +155,4 @@ private: @@ -155,4 +155,4 @@ private:
DatabaseWorkQueueMySQL* _asyncQueue;
};
#endif
#endif

2
src/server/shared/Database/MySQL/FieldMySQL.h

@ -7,4 +7,4 @@ class FieldMySQL : public Field @@ -7,4 +7,4 @@ class FieldMySQL : public Field
{
};
#endif
#endif

2
src/server/shared/Database/MySQL/PreparedStatementMySQL.cpp

@ -31,4 +31,4 @@ void PreparedStatementMySQL::ClearParameters() @@ -31,4 +31,4 @@ void PreparedStatementMySQL::ClearParameters()
delete[] (char*) _bind[i].buffer;
_bind[i].buffer = NULL;
}
}
}

2
src/server/shared/Database/MySQL/PreparedStatementMySQL.h

@ -21,4 +21,4 @@ private: @@ -21,4 +21,4 @@ private:
uint8_t _paramCount;
};
#endif
#endif

2
src/server/shared/Database/MySQL/QueryResultMySQL.h

@ -36,4 +36,4 @@ private: @@ -36,4 +36,4 @@ private:
MYSQL_FIELD* _fields;
};
#endif
#endif

2
src/server/shared/Database/PreparedStatement.h

@ -9,4 +9,4 @@ public: @@ -9,4 +9,4 @@ public:
PreparedStatement(uint32_t index) {};
};
#endif
#endif

2
src/server/shared/Database/QueryResult.h

@ -18,4 +18,4 @@ public: @@ -18,4 +18,4 @@ public:
typedef boost::shared_ptr<ResultSet> QueryResult;
#endif
#endif

118
src/server/shared/Logging/Log.cpp

@ -10,109 +10,109 @@ Log::Log(): logfile(NULL) @@ -10,109 +10,109 @@ Log::Log(): logfile(NULL)
Log::~Log()
{
if (logfile)
logfile.close();
if (logfile)
logfile.close();
}
void Log::Error(LogType type, const char * str, ...)
{
va_list ap;
va_start(ap, str);
va_list ap;
va_start(ap, str);
char text[MAX_MSG_LEN];
char text[MAX_MSG_LEN];
vsnprintf(text, MAX_MSG_LEN, str, ap);
Write(LOG_LEVEL_ERROR, type, std::string(text));
va_end(ap);
va_end(ap);
}
void Log::Warn(LogType type, const char * str, ...)
{
va_list ap;
va_start(ap, str);
va_list ap;
va_start(ap, str);
char text[MAX_MSG_LEN];
char text[MAX_MSG_LEN];
vsnprintf(text, MAX_MSG_LEN, str, ap);
Write(LOG_LEVEL_WARN, type, std::string(text));
va_end(ap);
va_end(ap);
}
void Log::Info(LogType type, const char * str, ...)
{
va_list ap;
va_start(ap, str);
va_list ap;
va_start(ap, str);
char text[MAX_MSG_LEN];
char text[MAX_MSG_LEN];
vsnprintf(text, MAX_MSG_LEN, str, ap);
Write(LOG_LEVEL_INFO, type, std::string(text));
va_end(ap);
va_end(ap);
}
void Log::Debug(LogType type, const char * str, ...)
{
va_list ap;
va_start(ap, str);
va_list ap;
va_start(ap, str);
char text[MAX_MSG_LEN];
char text[MAX_MSG_LEN];
vsnprintf(text, MAX_MSG_LEN, str, ap);
Write(LOG_LEVEL_DEBUG, type, std::string(text));
va_end(ap);
va_end(ap);
}
void Log::OpenLogFile(std::string path)
{
if (!logfile) {
logFileLoc = path + "/server-" + Util::Date("%Y%m%d-%H%M%S") + ".log";
logfile.open(logFileLoc.c_str());
}
if (!logfile) {
logFileLoc = path + "/server-" + Util::Date("%Y%m%d-%H%M%S") + ".log";
logfile.open(logFileLoc.c_str());
}
}
void Log::Write(LogLevel level, LogType type, std::string msg)
{
boost::lock_guard<boost::mutex> lock(_mutex);
switch(level)
{
case LOG_LEVEL_ERROR:
if (sConfig.Get<uint32_t>("LogConsoleLevel") >= level)
std::cout << "[ERROR] " << msg << std::endl;
if (sConfig.Get<uint32_t>("LogFileLevel") >= level)
AppendFile("[ERROR] " + msg);
break;
case LOG_LEVEL_WARN:
if (sConfig.Get<uint32_t>("LogConsoleLevel") >= level)
std::cout << "[WARN] " << msg << std::endl;
if (sConfig.Get<uint32_t>("LogFileLevel") >= level)
AppendFile("[WARN] " + msg);
break;
case LOG_LEVEL_INFO:
if (sConfig.Get<uint32_t>("LogConsoleLevel") >= level)
std::cout << "[INFO] " << msg << std::endl;
if (sConfig.Get<uint32_t>("LogFileLevel") >= level)
AppendFile("[INFO] " + msg);
break;
case LOG_LEVEL_DEBUG:
if (sConfig.Get<uint32_t>("LogConsoleLevel") >= level) {
uint32_t debugmask = sConfig.Get<uint32_t>("LogConsoleDebugMask");
if (debugmask & uint32_t(pow(2, type)))
std::cout << "[DEBUG] " << msg << std::endl;
}
if (sConfig.Get<uint32_t>("LogFileLevel") >= level) {
uint32_t debugmask = sConfig.Get<uint32_t>("LogFileDebugMask");
if (debugmask & uint32_t(pow(2, type)))
AppendFile("[DEBUG] " + msg);
}
break;
}
switch(level)
{
case LOG_LEVEL_ERROR:
if (sConfig.Get<uint32_t>("LogConsoleLevel") >= level)
std::cout << "[ERROR] " << msg << std::endl;
if (sConfig.Get<uint32_t>("LogFileLevel") >= level)
AppendFile("[ERROR] " + msg);
break;
case LOG_LEVEL_WARN:
if (sConfig.Get<uint32_t>("LogConsoleLevel") >= level)
std::cout << "[WARN] " << msg << std::endl;
if (sConfig.Get<uint32_t>("LogFileLevel") >= level)
AppendFile("[WARN] " + msg);
break;
case LOG_LEVEL_INFO:
if (sConfig.Get<uint32_t>("LogConsoleLevel") >= level)
std::cout << "[INFO] " << msg << std::endl;
if (sConfig.Get<uint32_t>("LogFileLevel") >= level)
AppendFile("[INFO] " + msg);
break;
case LOG_LEVEL_DEBUG:
if (sConfig.Get<uint32_t>("LogConsoleLevel") >= level) {
uint32_t debugmask = sConfig.Get<uint32_t>("LogConsoleDebugMask");
if (debugmask & uint32_t(pow(2, type)))
std::cout << "[DEBUG] " << msg << std::endl;
}
if (sConfig.Get<uint32_t>("LogFileLevel") >= level) {
uint32_t debugmask = sConfig.Get<uint32_t>("LogFileDebugMask");
if (debugmask & uint32_t(pow(2, type)))
AppendFile("[DEBUG] " + msg);
}
break;
}
}
void Log::AppendFile(std::string msg)
{
if (!logfile)
return;
logfile << msg << std::endl;
if (!logfile)
return;
logfile << msg << std::endl;
}

46
src/server/shared/Logging/Log.h

@ -14,40 +14,40 @@ @@ -14,40 +14,40 @@
enum LogType
{
LOG_GENERAL = 0,
LOG_SERVER = 1,
LOG_GENERAL = 0,
LOG_SERVER = 1,
LOG_DATABASE = 2
};
enum LogLevel
{
LOG_LEVEL_NONE = 0,
LOG_LEVEL_ERROR = 1,
LOG_LEVEL_WARN = 2,
LOG_LEVEL_INFO = 3,
LOG_LEVEL_DEBUG = 4
LOG_LEVEL_NONE = 0,
LOG_LEVEL_ERROR = 1,
LOG_LEVEL_WARN = 2,
LOG_LEVEL_INFO = 3,
LOG_LEVEL_DEBUG = 4
};
class Log
{
public:
Log();
~Log();
void Error(LogType type, const char * str, ...) ATTR_PRINTF(3, 4);
void Warn(LogType type, const char * str, ...) ATTR_PRINTF(3, 4);
void Info(LogType type, const char * str, ...) ATTR_PRINTF(3, 4);
void Debug(LogType type, const char * str, ...) ATTR_PRINTF(3, 4);
void OpenLogFile(std::string filename);
std::string logFileLoc;
Log();
~Log();
void Error(LogType type, const char * str, ...) ATTR_PRINTF(3, 4);
void Warn(LogType type, const char * str, ...) ATTR_PRINTF(3, 4);
void Info(LogType type, const char * str, ...) ATTR_PRINTF(3, 4);
void Debug(LogType type, const char * str, ...) ATTR_PRINTF(3, 4);
void OpenLogFile(std::string filename);
std::string logFileLoc;
private:
void Write(LogLevel level, LogType type, std::string msg);
void AppendFile(std::string);
std::string logfileloc;
std::ofstream logfile;
void Write(LogLevel level, LogType type, std::string msg);
void AppendFile(std::string);
std::string logfileloc;
std::ofstream logfile;
boost::mutex _mutex;
};

2
src/server/shared/Util.cpp

@ -14,4 +14,4 @@ std::string Util::Date(const char* format, bool utc) @@ -14,4 +14,4 @@ std::string Util::Date(const char* format, bool utc)
ss << now;
return ss.str();
}
}

2
src/server/shared/Util.h

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
namespace Util
{
std::string Date(const char* format, bool utc = false);
std::string Date(const char* format, bool utc = false);
template <typename T>
class SynchronisedQueue

Loading…
Cancel
Save