-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
38 lines (26 loc) · 1.11 KB
/
main.cpp
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
37
38
#include <SDL2/SDL.h>
#define PLOG_OMIT_LOG_DEFINES
#define PLOG_NO_DBG_OUT_INSTANCE_ID 1
#include <plog/Log.h>
#include <plog/Init.h>
#include <plog/Formatters/TxtFormatter.h>
#include <plog/Appenders/RollingFileAppender.h>
#include <plog/Appenders/ColorConsoleAppender.h>
#include "VPXDisplayServer.h"
int main(int argc, char* argv[]) {
plog::init<PLOG_DEFAULT_INSTANCE_ID>();
plog::Logger<PLOG_DEFAULT_INSTANCE_ID>::getInstance()->setMaxSeverity(plog::info);
char* szBasePath = SDL_GetBasePath();
string szPath = szBasePath;
SDL_free(szBasePath);
string szLogPath = szPath + "vpxds.log";
static plog::RollingFileAppender<plog::TxtFormatter> fileAppender(szLogPath.c_str(), 1024 * 1024 * 5, 1);
plog::Logger<PLOG_DEFAULT_INSTANCE_ID>::getInstance()->addAppender(&fileAppender);
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
plog::Logger<PLOG_DEFAULT_INSTANCE_ID>::getInstance()->addAppender(&consoleAppender);
VPXDisplayServer* pServer = new VPXDisplayServer();
pServer->SetBasePath(szPath);
int res = pServer->Start();
delete pServer;
return res;
}