1 Star 1 Fork 0

hotmocha/spider

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ilog.h 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
hotmocha 提交于 2015-04-02 22:29 +08:00 . spider init
#ifndef _ILOG_H_
#define _ILOG_H_
#define _THREADLOG_ //定义是否用于多线程
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdarg.h>
#include <fcntl.h>
#include <sys/time.h>
#include <unistd.h>
#define ulong unsigned long
#define uint unsigned int
#if ( defined _THREADLOG_ )
#include <pthread.h>
#define TLS __thread
#else
#define TLS
#endif
#define LOGFILEMAXLEN 1024
#define LOGBUFLEN 2048
#define LOGFILENAMEMAXLEN 1024
#define LOGDEFAULTLEVEL LOG_LEVEL_INFO
#define LOG_LEVEL_DEBUG 0
#define LOG_LEVEL_WARN 1
#define LOG_LEVEL_INFO 2
#define LOG_LEVEL_ERROR 3
#define LOG_LEVEL_FATAL 4
#define PROCESSID getpid()
#define THREADID pthread_self()
#define ADDNEWLINE( __buf__, __usedlen__, __remainlen__ ) \
sprintf(__buf__, "\n"); \
__buf__++; \
__usedlen__++; \
__remainlen__--
int SetLogFile( char *format, ...);
int SetLogLevel( int loglevel );
/* 输入到文件的接口 */
int FatalLog( char *filename, ulong fileline, char *format, ...);
int ErrorLog( char *filename, ulong fileline, char *format, ...);
int InfoLog( char *filename, ulong fileline, char *format, ...);
int DebugLog( char *filename, ulong fileline, char *format, ...);
int WarnLog( char *filename, ulong fileline, char *format, ...);
typedef struct
{
char PathFielTemplate[LOGFILEMAXLEN + 1];
char PathFileName[LOGFILENAMEMAXLEN + 1];
char MsgBuf[LOGBUFLEN + 1];
char MsgTemplate[LOGBUFLEN + 1];
int LogLevel;
}LogEnv;
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hotmocha/spider.git
[email protected]:hotmocha/spider.git
hotmocha
spider
spider
master

搜索帮助