https://github.com/linuxdeepin/dtklog
https://github.com/linuxdeepin/dtklog
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/linuxdeepin/dtklog
- Owner: linuxdeepin
- License: lgpl-2.1
- Created: 2024-06-28T07:46:08.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2026-04-09T13:25:07.000Z (about 2 months ago)
- Last Synced: 2026-04-09T15:23:28.359Z (about 2 months ago)
- Language: C++
- Size: 250 KB
- Stars: 3
- Watchers: 3
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.LGPL
Awesome Lists containing this project
README
# DtkLog
Simple, convinient and thread safe logger for Qt-based C++ apps
## Short example
```cpp
#include
#include
#include
#include
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
#include
```