-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.cpp
34 lines (26 loc) · 1.09 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
#include "mainwindow.hpp"
#include <QsLog.h>
#include <QsLogDest.h>
#include <QApplication>
#include <QDir>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("ThamSoft");
QCoreApplication::setOrganizationDomain("https://github.com/stereomatchingkiss");
QCoreApplication::setApplicationName("QImageScraper");
using namespace QsLogging;
// 1. init the logging mechanism
Logger& logger = Logger::instance();
logger.setLoggingLevel(QsLogging::TraceLevel);
const QString sLogPath(QDir(a.applicationDirPath()).filePath("log.txt"));
// 2. add two destinations
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination(
sLogPath, LogRotationOption::EnableLogRotation, MaxSizeBytes(1024*1024*2), MaxOldLogCount(2)));
DestinationPtr debugDestination(DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(std::move(debugDestination));
logger.addDestination(std::move(fileDestination));
MainWindow w;
w.show();
return a.exec();
}