LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
// Copyright 2002-2013 CEA LIST
2
// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3
//
4
// SPDX-License-Identifier: MIT
5
6
#include "
common/LimaCommon.h
"
7
#include "
QsLog.h
"
8
#include "
QsLogDest.h
"
9
#include "
QsLogCategories.h
"
10
#include <QtCore/QCoreApplication>
11
#include <QDir>
12
#include <iostream>
13
14
int
main
(
int
argc,
char
*argv[])
15
{
16
QCoreApplication a(argc, argv);
17
QsLogging::initQsLog
();
18
int
ret = 0;
19
{
20
// init the logging mechanism
21
QsLogging::Logger
& logger =
QsLogging::Logger::instance
(
"Zone"
);
22
logger.
setLoggingLevel
(
QsLogging::TraceLevel
);
23
const
QString sLogPath(QDir(
"."
).filePath(
"log.txt"
));
24
QsLogging::DestinationPtr
fileDestination(
25
QsLogging::DestinationFactory::MakeFileDestination
(sLogPath) );
26
QsLogging::DestinationPtr
debugDestination(
27
QsLogging::DestinationFactory::MakeDebugOutputDestination
() );
28
logger.
addDestination
(debugDestination);
29
logger.
addDestination
(fileDestination);
30
//logger.setLoggingLevel(QsLogging::InfoLevel);
31
32
QLOG_INFO
() <<
"Program started"
;
33
QLOG_INFO
() <<
"Built with Qt"
<< QT_VERSION_STR <<
"running on"
<< qVersion();
34
35
QLOG_TRACE
() <<
"Here's a"
<< QLatin1String(
"trace"
) <<
"message"
;
36
QLOG_DEBUG
() <<
"Here's a"
<<
static_cast<
int
>
(
QsLogging::DebugLevel
) <<
"message"
;
37
QLOG_WARN
() <<
"Uh-oh!"
;
38
qDebug() <<
"This message won't be picked up by the logger"
;
39
QLOG_ERROR
() <<
"An error has occurred"
;
40
qWarning() <<
"Neither will this one"
;
41
QLOG_FATAL
() <<
"Fatal error!"
;
42
}
43
{
44
AGLOGINIT
;
45
LDEBUG
<<
"AnalysisGraph 1"
;
46
}
47
{
48
CLIENTFACTORYLOGINIT
;
49
LDEBUG
<<
"Oh!"
;
50
}
51
{
52
AGLOGINIT
;
53
LDEBUG
<<
"AnalysisGraph 2"
;
54
}
55
return
ret;
56
}
LimaCommon.h
CLIENTFACTORYLOGINIT
#define CLIENTFACTORYLOGINIT
Definition
LimaCommon.h:202
AGLOGINIT
#define AGLOGINIT
Definition
LimaCommon.h:200
LDEBUG
#define LDEBUG
Definition
LimaCommon.h:157
QsLogCategories.h
QsLogDest.h
QsLog.h
QLOG_ERROR
#define QLOG_ERROR()
Definition
QsLog.h:153
QLOG_DEBUG
#define QLOG_DEBUG()
Definition
QsLog.h:144
QLOG_FATAL
#define QLOG_FATAL()
Definition
QsLog.h:156
QLOG_WARN
#define QLOG_WARN()
Definition
QsLog.h:150
QLOG_INFO
#define QLOG_INFO()
Definition
QsLog.h:147
QLOG_TRACE
#define QLOG_TRACE()
Logging macros: define QS_LOG_LINE_NUMBERS to get the file and line number in the log output.
Definition
QsLog.h:141
QsLogging::DestinationFactory::MakeDebugOutputDestination
static DestinationPtr MakeDebugOutputDestination()
Definition
QsLogDest.cpp:249
QsLogging::DestinationFactory::MakeFileDestination
static DestinationPtr MakeFileDestination(const QString &filePath)
Definition
QsLogDest.cpp:243
QsLogging::Logger
Definition
QsLog.h:60
QsLogging::Logger::instance
static Logger & instance(const QString &zone=QLatin1String(""))
Definition
QsLog.h:63
QsLogging::Logger::setLoggingLevel
void setLoggingLevel(Level newLevel)
Logging at a level < 'newLevel' will be ignored.
Definition
QsLog.cpp:115
QsLogging::Logger::addDestination
void addDestination(std::shared_ptr< Destination > destination)
Adds a log message destination. Don't add null destinations.
Definition
QsLog.cpp:108
main
int main(int argc, char *argv[])
Definition
main.cpp:14
QsLogging::DestinationPtr
std::shared_ptr< Destination > DestinationPtr
Definition
QsLog.cpp:47
QsLogging::TraceLevel
@ TraceLevel
Definition
QsLog.h:48
QsLogging::DebugLevel
@ DebugLevel
Definition
QsLog.h:49
QsLogging::initQsLog
LIMA_COMMONQSLOG_EXPORT bool initQsLog(const QString &configString)
Definition
QsLogCategories.cpp:193
lima_common
src
common
QsLog
main.cpp
Generated by
1.9.8