MyLib
This commit is contained in:
47
Test/LogTest.cpp
Normal file
47
Test/LogTest.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include "Test.h"
|
||||
|
||||
#include "ConfigParser.h"
|
||||
#include "LogL.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void Log_Test() {
|
||||
unordered_map<string, string> config;
|
||||
configFromIni("ini\\config.ini", config);
|
||||
//日志类型
|
||||
LogType tmpLogType = LTStd;
|
||||
auto tmp = config.find("logType");
|
||||
if (tmp != config.end()) {
|
||||
if (tmp->second == "udp") {
|
||||
tmpLogType = LTUdp;
|
||||
}
|
||||
else if (tmp->second == "txt") {
|
||||
tmpLogType = LTTxt;
|
||||
}
|
||||
else if (tmp->second == "std") {
|
||||
tmpLogType = LTStd;
|
||||
}
|
||||
}
|
||||
//日志地址
|
||||
string tmpLogPath;
|
||||
tmp = config.find("logPath");
|
||||
if (tmp != config.end()) {
|
||||
tmpLogPath = tmp->second;
|
||||
}
|
||||
//日志状态
|
||||
bool tmpLogStatus = true;
|
||||
tmp = config.find("logStatus");
|
||||
if (tmp != config.end()) {
|
||||
if (tmp->second == "sync") {
|
||||
tmpLogStatus = true;
|
||||
}
|
||||
else {
|
||||
tmpLogStatus = false;
|
||||
}
|
||||
}
|
||||
LogL logL(tmpLogType, tmpLogStatus, tmpLogPath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user