mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-11 09:49:04 +00:00
58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
|
|
|
|
#ifndef LOGGER_SERVICE_H
|
|
#define LOGGER_SERVICE_H
|
|
|
|
#include "server_share/logger_service_itf.h"
|
|
#include "nel/misc/sstring.h"
|
|
#include "nel/misc/file.h"
|
|
#include "nel/net/service.h"
|
|
#include <time.h>
|
|
|
|
typedef uint32 TShardId;
|
|
|
|
/// struct to hold a log entry
|
|
struct TLogEntry
|
|
{
|
|
// A unique ID for this logging sessions
|
|
uint32 LogId;
|
|
// that shard that sent the log
|
|
TShardId ShardId;
|
|
// The log info
|
|
LGS::TLogInfo LogInfo;
|
|
};
|
|
|
|
/// A list of log entry
|
|
typedef std::list<TLogEntry> TLogInfos;
|
|
|
|
|
|
/// A vector of log definitions
|
|
typedef std::vector < LGS::TLogDefinition > TLogDefinitions;
|
|
|
|
class CQueryParser *createQueryParser(const TLogDefinitions &logDefs);
|
|
|
|
|
|
inline std::string formatDate(time_t date)
|
|
{
|
|
date &= 0x7fffffff;
|
|
struct tm *t=localtime(&date);
|
|
|
|
char dateStr[1024];
|
|
strftime(dateStr, 1024, "%Y-%m-%d %H:%M:%S", t);
|
|
|
|
return dateStr;
|
|
|
|
//
|
|
// return NLMISC::toString("%4u-%02u-%02u %2u:%02u:%02u",
|
|
// t->tm_year+1900,
|
|
// t->tm_mon+1,
|
|
// t->tm_mday,
|
|
// t->tm_hour,
|
|
// t->tm_min,
|
|
// t->tm_sec);
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif //LOGGER_SERVICE_H
|