1 Star 0 Fork 0

zhyulo/Stream

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
log.h 1.92 KB
一键复制 编辑 原始数据 按行查看 历史
zhyulo 提交于 2021-07-12 02:04 . 1.0版本
#ifndef _LOG_H_
#define _LOG_H_
#include <stdio.h>
#ifndef LOG_LEVEL
#define LOG_LEVEL 5
#endif
/*
* This is the local tag used for the following simplified
* logging macros. You can change this preprocessor definition
* before using the other macros to change the tag.
*/
#ifndef LOG_TAG
#define LOG_TAG "LOG"
#endif
/*
* Simplified macro to send a verbose log message using the current LOG_TAG.
*/
#ifndef LOGV
#if LOG_LEVEL > 4
#define LOGV(fmt, ...) fprintf(stdout, LOG_TAG "(V): " fmt "\n", ##__VA_ARGS__)
#else
#define LOGV(fmt, ...)
#endif
#endif
/*
* Simplified macro to send a debug log message using the current LOG_TAG.
*/
#ifndef LOGD
#if LOG_LEVEL > 3
#define LOGD(fmt, ...) fprintf(stdout, LOG_TAG "(D): " fmt "\n", ##__VA_ARGS__)
#else
#define LOGD(fmt, ...)
#endif
#endif
/*
* Simplified macro to send an info log message using the current LOG_TAG.
*/
#ifndef LOGI
#if LOG_LEVEL > 2
#define LOGI(fmt, ...) fprintf(stdout, LOG_TAG "(I): " fmt "\n", ##__VA_ARGS__)
#else
#define LOGI(fmt, ...)
#endif
#endif
/*
* Simplified macro to send a warning log message using the current LOG_TAG.
*/
#ifndef LOGW
#if LOG_LEVEL > 1
#define LOGW(fmt, ...) fprintf(stderr, LOG_TAG "(W): " fmt "\n", ##__VA_ARGS__)
#else
#define LOGW(fmt, ...)
#endif
#endif
/*
* Simplified macro to send an error log message using the current LOG_TAG.
*/
#ifndef LOGE
#if LOG_LEVEL > 0
#define LOGE(fmt, ...) fprintf(stderr, LOG_TAG "(E): " fmt "\n", ##__VA_ARGS__)
#else
#define LOGE(fmt, ...)
#endif
#endif
#define Warn(fmt, ...) fprintf(stderr, "%s(%d, %d): warning: " fmt "\n", \
Input.fileName, TokenLine, TokenColumn, ##__VA_ARGS__)
#define Error(fmt, ...) fprintf(stderr, "%s(%d, %d): error: " fmt "\n", \
Input.fileName, TokenLine, TokenColumn, ##__VA_ARGS__)
enum {
EXT_UnknowErr = -1,
EXT_OK = 0,
EXT_NotExpect,
EXT_MemoryFull,
EXT_FileOpenFail,
EXT_NodeKindErr,
EXT_OutputBufferFull
};
#endif // _LOG_H_
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/zhyulo/Stream.git
git@gitee.com:zhyulo/Stream.git
zhyulo
Stream
Stream
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385