File: README.md

package info (click to toggle)
dtk6log 0.0.6-2~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 388 kB
  • sloc: cpp: 1,682; ansic: 59; makefile: 9
file content (49 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (2)
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
39
40
41
42
43
44
45
46
47
48
49
# Dtk6Log

Simple, convinient and thread safe logger for Qt6-based C++ apps

## Short example

```cpp
#include <QCoreApplication>
#include <QDebug>

#include <dloghelper.h>
#include <ConsoleAppender.h>

DLOG_CORE_USE_NAMESPACE
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    
    auto consoleAppender = new ConsoleAppender;
    consoleAppender->setFormat("[%{type:-7}] <%{Function}> %{message}\n");
    dlogger->registerAppender(consoleAppender);

    dInfo("Starting the application");

    dWarning() << "Something went wrong." << "Result code is" << -1;

    return 0;
}
```

## Adding Dtk6Log to your project

Add this repo as a git submodule to your project. 


Include it to your CMakeLists.txt file:
```cmake
find_package(Dtk6Log REQUIRED)
...

...
TARGET_LINK_LIBRARIES(${your_target} ... Dtk6::Log)
```

Include `dloghelper.h` and one or several appenders of your choice:
```cpp
#include <dloghelper.h>
#include <ConsoleAppender.h>
```