///
// Printf
\033[0m 關閉所有屬性
\033[1m 設置高亮度
\033[4m 下劃線
\033[5m 閃爍
\033[7m 反顯
\033[8m 消隱
\033[30m -- \033[37m 設置前景色
\033[40m -- \033[47m 設置背景色
\033[nA 光標上移n行
\033[nB 光標下移n行
\033[nC 光標右移n行
\033[nD 光標左移n行
\033[y;xH設置光標位置
\033[2J 清屏
\033[K 清除從光標到行尾的內容
\033[s 保存光標位置
\033[u 恢復光標位置
\033[?25l 隱藏光標
\033[?25h 顯示光標
///
#define DBG_FG_BLACK "\033[30m" //改变输出字母的颜色 30~39用來設置字體色,40~49設置背景色
#define DBG_FG_RED "\033[31m"
#define DBG_FG_GREEN "\033[32m"
#define DBG_FG_YELLOW "\033[33m"
#define DBG_FG_BLUE "\033[34m"
#define DBG_FG_VIOLET "\033[35m"
#define DBG_FG_VIRDIAN "\033[36m"
#define DBG_FG_WHITE "\033[37m"
#define DBG_BG_BLACK "\033[40m"
#define DBG_BG_RED "\033[41m"
#define DBG_BG_GREEN "\033[42m"
#define DBG_BG_YELLOW "\033[43m"
#define DBG_BG_BLUE "\033[44m"
#define DBG_BG_VIOLET "\033[45m"
#define DBG_BG_VIRDIAN "\033[46m"
#define DBG_BG_WHITE "\033[47m"
#define DBG_END "\033[0m"
#define DBG_LEVEL_FATAL 1 //设置printf等级
#define DBG_LEVEL_MAJOR 2
#define DBG_LEVEL_WARNING 3
#define DBG_LEVEL_DEBUGGING 4
#define DBG_LEVEL_INFO 5
unsigned int g_embedded_cam_dbg_level = 1;
const char *g_szModuleName[] = {"FALCON", "V4L2", "AIT"};
const char *g_szLevelName[] = {"-", "Fatal", "Major", "Warning", "Debugging", "Info"};
void PrintDebug(unsigned int module, unsigned int level, const char *func, int line, const char* format, ...)
{
if (g_embedded_cam_dbg_level < level)
{
return;
}
char output[1024] = {0, };
if (level > 0)
{
snprintf(output, 1023, "[%s/%s] [%s:%d] %s", g_szModuleName[module], g_szLevelName[level],
func, line, (level == DBG_LEVEL_FATAL) ? DBG_FG_RED : "");
}
printf("%s", output);
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
printf("%s\n", (level == DBG_LEVEL_FATAL) ? DBG_END : "");
}
#define PrintCamFatal(args...) PrintDebug("FALCON", DBG_LEVEL_FATAL, __FUNCTION__, __LINE__, args);
#define PrintCamWarning(args...) PrintDebug("FALCON", DBG_LEVEL_WARNING, __FUNCTION__, __LINE__, args);
PrintCamFatal("ulDuration : %d ms", ulDuration);
PrintCamWarning("Language Pack Update Fail!");
// Printf
\033[0m 關閉所有屬性
\033[1m 設置高亮度
\033[4m 下劃線
\033[5m 閃爍
\033[7m 反顯
\033[8m 消隱
\033[30m -- \033[37m 設置前景色
\033[40m -- \033[47m 設置背景色
\033[nA 光標上移n行
\033[nB 光標下移n行
\033[nC 光標右移n行
\033[nD 光標左移n行
\033[y;xH設置光標位置
\033[2J 清屏
\033[K 清除從光標到行尾的內容
\033[s 保存光標位置
\033[u 恢復光標位置
\033[?25l 隱藏光標
\033[?25h 顯示光標
///
#define DBG_FG_BLACK "\033[30m" //改变输出字母的颜色 30~39用來設置字體色,40~49設置背景色
#define DBG_FG_RED "\033[31m"
#define DBG_FG_GREEN "\033[32m"
#define DBG_FG_YELLOW "\033[33m"
#define DBG_FG_BLUE "\033[34m"
#define DBG_FG_VIOLET "\033[35m"
#define DBG_FG_VIRDIAN "\033[36m"
#define DBG_FG_WHITE "\033[37m"
#define DBG_BG_BLACK "\033[40m"
#define DBG_BG_RED "\033[41m"
#define DBG_BG_GREEN "\033[42m"
#define DBG_BG_YELLOW "\033[43m"
#define DBG_BG_BLUE "\033[44m"
#define DBG_BG_VIOLET "\033[45m"
#define DBG_BG_VIRDIAN "\033[46m"
#define DBG_BG_WHITE "\033[47m"
#define DBG_END "\033[0m"
#define DBG_LEVEL_FATAL 1 //设置printf等级
#define DBG_LEVEL_MAJOR 2
#define DBG_LEVEL_WARNING 3
#define DBG_LEVEL_DEBUGGING 4
#define DBG_LEVEL_INFO 5
unsigned int g_embedded_cam_dbg_level = 1;
const char *g_szModuleName[] = {"FALCON", "V4L2", "AIT"};
const char *g_szLevelName[] = {"-", "Fatal", "Major", "Warning", "Debugging", "Info"};
void PrintDebug(unsigned int module, unsigned int level, const char *func, int line, const char* format, ...)
{
if (g_embedded_cam_dbg_level < level)
{
return;
}
char output[1024] = {0, };
if (level > 0)
{
snprintf(output, 1023, "[%s/%s] [%s:%d] %s", g_szModuleName[module], g_szLevelName[level],
func, line, (level == DBG_LEVEL_FATAL) ? DBG_FG_RED : "");
}
printf("%s", output);
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
printf("%s\n", (level == DBG_LEVEL_FATAL) ? DBG_END : "");
}
#define PrintCamFatal(args...) PrintDebug("FALCON", DBG_LEVEL_FATAL, __FUNCTION__, __LINE__, args);
#define PrintCamWarning(args...) PrintDebug("FALCON", DBG_LEVEL_WARNING, __FUNCTION__, __LINE__, args);
PrintCamFatal("ulDuration : %d ms", ulDuration);
PrintCamWarning("Language Pack Update Fail!");