-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlogger.cpp
More file actions
36 lines (30 loc) · 809 Bytes
/
logger.cpp
File metadata and controls
36 lines (30 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "logger.h"
#include <ctime>
using namespace std;
logger::logger() {}
logger::~logger() {}
void logger::WriteLogFormat(const char *format, ...) {
va_list arglist;
string strArgData;
char szBuffer[0x1024];
ZeroMemory(szBuffer, 0x1024);
va_start(arglist, format);
vsprintf_s(szBuffer, format, arglist);
va_end(arglist);
strArgData = szBuffer;
fstream of("igdlLog.txt", ios::app);
if (!of.is_open()) return;
of << GetSystemTimes() << ": " << strArgData << endl;
of.close();
}
string logger::GetSystemTimes() {
time_t Time;
tm t;
CHAR strTime[MAX_PATH];
ZeroMemory(strTime, MAX_PATH);
time(&Time);
localtime_s(&t, &Time);
strftime(strTime, 100, "%m-%d %H:%M:%S ", &t);
string strTimes = strTime;
return strTimes;
}