Ai
6 Star 0 Fork 0

luogic/烫烫烫小组文件服务器

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
log_customize.c 611 Bytes
一键复制 编辑 原始数据 按行查看 历史
liuruoyu 提交于 2024-04-14 20:00 +08:00 . log create
#include <my_header.h>
void log(int num, const char *funname, const char *name)
{
time_t nowtime;
struct tm *timeinfo;
char timebuf[60];
time(&nowtime);
timeinfo=localtime(&nowtime);
strftime(timebuf, 60, "%Y-%m-%d %H:%M:%S", timeinfo);
int time_len=strlen(timebuf);
char *path_info="my_info.log";
int fd_info=open(path_info,O_RDWR|O_APPEND|O_CREAT,0777);
ERROR_CHECK(fd_info ,-1,"infoOpen");
char buf[60]={0};
sprintf(buf," %s: %s: %d \n", name,funname,num);
int len=strlen(buf);
write(fd_info,timebuf,time_len);
write(fd_info,buf,len);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/luogic/file.git
git@gitee.com:luogic/file.git
luogic
file
烫烫烫小组文件服务器
master

搜索帮助