31 lines
493 B
C
31 lines
493 B
C
#ifndef LOG_H
|
|
#define LOG_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
// 日志级别枚举
|
|
typedef enum {
|
|
Info,
|
|
Warn,
|
|
Error,
|
|
Debug
|
|
} LogLevel;
|
|
|
|
// 初始化日志文件(可选,设置自定义日志文件路径)
|
|
void InitLog(const char* logFilePath);
|
|
|
|
// 写日志的核心函数
|
|
void WriteLog(LogLevel level, const char* format, ...);
|
|
|
|
// 关闭日志文件(可选,用于释放资源)
|
|
void CloseLog();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // LOG_H
|