代码拉取完成,页面将自动刷新
A simple (colored) log library for Qt
Null Log Library是一个为Qt制作的简易日志工具,它可以帮助您输出美观的彩色日志。
Null Log Library is a simple library made for Qt, it can help you out beautiful (colored) log for you.
我们假设您使用Qt5或者Qt6以及CMake。
We assume that you are using either Qt 5 or Qt 6 together with CMake.
src
或者demo_src
里),设置如下CMake前缀:src
nor src_demo
) and set the following Cmake Prefix:-DCMAKE_PREFIX_PATH:PATH="<Qt安装路径 · Qt Installation path>"
-DCMAKE_PREFIX_PATH:PATH="D:/SDK/Qt/6.8.0/msvc2022_64"
./demo_src/CMakeLists.txt
。./demo_src/CMakeLists.txt
.target_include_directories
,该值决定了库中的头文件是否能被找到,本项目的/includes
文件夹里面有所需的所有头文件,需要的话可以复制一份。CMakeList
to fit your project, please ESPECIALLY NOTE THE VARIABLE target_include_directories
, which decided whether IDE would tell you that you got missing header(s) (from this library). The /includes
folder of this project contains all the headers you will need, and you can copy that if needed.以下是本库目前支持的函数的签名:
Here are the function signatures that you can use:
static void setIsColorEnabled(bool result);
static bool getIsColorEnabled(void);
static QString info(const QString& tag, const QString& content);
static QString info(const QString& tag, const QString& title, const QString& content);
static QString ok(const QString& tag, const QString& content);
static QString ok(const QString& tag, const QString& title, const QString& content);
static QString warn(const QString& tag, const QString& content);
static QString warn(const QString& tag, const QString& title, const QString& content);
static QString error(const QString& tag, const QString& content);
static QString error(const QString& tag, const QString& title, const QString& content);
setIsColorEnabled
: 设置彩色日志输出是否开启,true
为开启,false
为关闭;彩色日志输出默认开启。这是全局设置,并且设置后会产生一条日志。setIsColorEnabled
: Set if colored log output should be enabled, true
for enabling and false
for disabling; Colored log output is enabled by default. This is global config, and a log will be generated after you toggle the setting.getIsColorEnabled
: 获取彩色日志输出状态,返回true
为开启,false
为关闭。getIsColorEnabled
: Get if colored log output is enabled, returning true
for enabling and false
for disabling.名称 · Parameter Name | 解释 · Explaination | 是否必须 · Is that Required |
---|---|---|
tag | 您定义的标签名,用于告诉其他开发者这是哪个模块正在输出日志 | 是 |
tag | Tag name that is defined by you that tells others which module is generating log | Yes |
title | 可选的标题名,用于进一步定位产生日志的代码 | 否 |
title | Optional title that helps locating the code that throws the log | No |
content | 日志的具体内容 | 是 |
content | Content of your log | Yes |
OK
使用的是qInfo
。QString
,内容是(没有颜色的)您的日志内容,您可以利用这个自己实现日志储存。OK
uses qInfo
.QString
and they are actually returning the log generated (without color) so you may use them.
本项目以GPL-2.0许可分发,请参阅LICENSE文件以获取更多信息。
This project is distributed under GPL-2.0. See LICENSE for more information.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。