File: README.md

package info (click to toggle)
dtklog 0.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: cpp: 1,683; ansic: 59; makefile: 9
file content (49 lines) | stat: -rw-r--r-- 967 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
# DtkLog

Simple, convinient and thread safe logger for Qt-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 DtkLog to your project

Add this repo as a git submodule to your project. 


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

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

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