この記事では、最初の個人的なブログ登場https://kezunlin.me/post/a201e11b/最新の内容に、ようこそ!
cppのプログラム用着色印刷およびトレースのためのカラーホイール
ガイド
インストール
sudo wget -O /usr/include/colorwheel.h https://raw.githubusercontent.com/Totoditoto/colorwheel/master/colorwheel.h
/usr/include/colorwheel.h
使用法
ヘッダのみを含みます
#include <colorwheel.h>
マクロ
/* Predefined printf styled messages */
CW_PRINT_NORMAL(message, ...);
CW_PRINT_ALARM(message, ...);
CW_PRINT_CRITICAL(message, ...);
CW_PRINT_FAULT(message, ...);
CW_PRINT_VALID(message, ...);
CW_PRINT_INFO(message, ...);
/* Predefined trace styled messages (indicates file, function and line) */
CW_TRACE_NORMAL(message, ...);
CW_TRACE_ALARM(message, ...);
CW_TRACE_CRITICAL(message, ...);
CW_TRACE_FAULT(message, ...);
CW_TRACE_VALID(message, ...);
CW_TRACE_INFO(message, ...);
コード
#include <colorwheel.h>
void demo_colorwheel(void)
{
CW_TRACE_NORMAL("This is a normal information");
CW_TRACE_INFO("This is a noticeable information");
CW_TRACE_FAULT("Ooops something might have gone wrong");
CW_TRACE_VALID("Finally it's okay, don't worry");
//CW_TRACE_NORMAL("Nevermind");
int value = 10;
CW_TRACE_CRITICAL("It was way worse than expected! Computer will explode in %d s", value);
CW_TRACE_ALARM("IT IS TOO LATE RUN AWAY");
}
参照
歴史
- 20191010:作成しました。
著作権
- 投稿者:kezunlin
- ポストリンク:https://kezunlin.me/post/a201e11b/
- 著作権:別途明記しない限り、このブログのすべての記事はCC BY-NC-SA 3.0の下でライセンスされています。