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
14int main(int argc, char *argv[])
15{
16 QCoreApplication a(argc, argv);
18 int ret = 0;
19 {
20 // init the logging mechanism
23 const QString sLogPath(QDir(".").filePath("log.txt"));
24 QsLogging::DestinationPtr fileDestination(
26 QsLogging::DestinationPtr debugDestination(
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 {
45 LDEBUG << "AnalysisGraph 1";
46 }
47 {
49 LDEBUG << "Oh!";
50 }
51 {
53 LDEBUG << "AnalysisGraph 2";
54 }
55 return ret;
56}
#define CLIENTFACTORYLOGINIT
Definition LimaCommon.h:202
#define AGLOGINIT
Definition LimaCommon.h:200
#define LDEBUG
Definition LimaCommon.h:157
#define QLOG_ERROR()
Definition QsLog.h:153
#define QLOG_DEBUG()
Definition QsLog.h:144
#define QLOG_FATAL()
Definition QsLog.h:156
#define QLOG_WARN()
Definition QsLog.h:150
#define QLOG_INFO()
Definition QsLog.h:147
#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
static DestinationPtr MakeDebugOutputDestination()
static DestinationPtr MakeFileDestination(const QString &filePath)
static Logger & instance(const QString &zone=QLatin1String(""))
Definition QsLog.h:63
void setLoggingLevel(Level newLevel)
Logging at a level < 'newLevel' will be ignored.
Definition QsLog.cpp:115
void addDestination(std::shared_ptr< Destination > destination)
Adds a log message destination. Don't add null destinations.
Definition QsLog.cpp:108
int main(int argc, char *argv[])
Definition main.cpp:14
std::shared_ptr< Destination > DestinationPtr
Definition QsLog.cpp:47
@ TraceLevel
Definition QsLog.h:48
@ DebugLevel
Definition QsLog.h:49
LIMA_COMMONQSLOG_EXPORT bool initQsLog(const QString &configString)