당신의 C ++ 프로그램 콘솔 출력 컬러 로그 정보를 확인하는 코드의 라인을 사용하는 방법

이 문서는 먼저 개인 블로그 나타났다 https://kezunlin.me/post/a201e11b/ 최신 내용에 오신 것을 환영합니다!

CPP 프로그램에 대한 색 인쇄 및 추적을위한 colorwheel

안내서

설치

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에 의거하여 라이센스가 부여됩니다.

추천

출처www.cnblogs.com/kezunlin/p/12033135.html