Debian Codegraph @

examples/dlog-example/main.cpp

raw
1 // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-or-later
4
5 #include <DLog>
6 #include <QCoreApplication>
7 #include <QTimer>
8
9 DCORE_USE_NAMESPACE
10
11 int main(int argc, char **argv)
12 {
13 QCoreApplication app(argc, argv);
14 #ifdef Q_OS_LINUX
15 DLogManager::registerJournalAppender();
16 #endif
17 DLogManager::registerConsoleAppender();
18 dDebug() << "Anything that can possibly go wrong, will go wrong. ";
19 qWarning() << "FBI Warning: Code smells.";
20 qInfo() << "Why dark mode? Because light attracts bugs";
21 qCritical() << "You Should Never Run `sudo rm -rf /`";
22
23 {
24 dDebugTime("Test the running time of a code block");
25 QTimer timer;
26 timer.setInterval(500);
27 QEventLoop loop;
28 QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
29 timer.start();
30 loop.exec();
31 }
32
33 return app.exec();
34 }