Dev (#11)
* #feat 增强Fatal级别的底色,修改logging类的方法 * 更新版本号 * 加入test脚本 * fix:conanfile * test action * 修复错别字 * add test on windows action * fix test on windows action * fix action on windows * fix * fix 内存分配错误 * fix msvc 不支持中文注释,删除中文注释 * test on windows and test chinese char * ersion 0.2.4 * feature:根据文件大小分割日志 * fix:内存泄露 * fix:使用char偏移单位
This commit is contained in:
15
src/utils/logging-utils.c
Normal file
15
src/utils/logging-utils.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "logging-utils.h"
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* @brief 获取当前时间字符串
|
||||
* @param timeStr 存储时间字符串缓冲区指针
|
||||
*/
|
||||
void getTimeStr(char *timeStr) {
|
||||
time_t t = time(NULL);
|
||||
struct tm *p = localtime(&t);
|
||||
char _timeStr[20];
|
||||
strftime(_timeStr, sizeof(_timeStr), "%Y-%m-%d %H:%M:%S", p);
|
||||
strcpy(timeStr, _timeStr);
|
||||
}
|
||||
5
src/utils/logging-utils.h
Normal file
5
src/utils/logging-utils.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifndef __LOGGING_UTILS_H__
|
||||
#define __LOGGING_UTILS_H__
|
||||
|
||||
void getTimeStr(char *timeStr);
|
||||
#endif // __LOGGING_UTILS_H__
|
||||
Reference in New Issue
Block a user