acl/lib_acl/include/stdlib/acl_mylog.h

87 lines
2.1 KiB
C
Raw Normal View History

#ifndef ACL_MYLOG_INCLUDE_H
2014-11-19 00:25:21 +08:00
#define ACL_MYLOG_INCLUDE_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "acl_define.h"
#include "acl_vstream.h"
#ifdef ACL_UNIX
#include <netinet/in.h>
#endif
typedef struct ACL_LOG ACL_LOG;
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
* @param buf {char*} <EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param size {size_t} buf <EFBFBD>Ŀռ<EFBFBD><EFBFBD><EFBFBD>С
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_logtime_fmt(char *buf, size_t size);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>߳<EFBFBD>ID<EFBFBD>ţ<EFBFBD>Ĭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>
* @param onoff {int} <EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>¼<EFBFBD>߳<EFBFBD>ID<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򲻼<EFBFBD>¼
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_log_add_tid(int onoff);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param fp {ACL_VSTREAM *} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param plog_pre {const char*} <EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>Ϣǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_log_fp_set(ACL_VSTREAM *fp, const char *plog_pre);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD>ļ<EFBFBD>
* @param recipients {const char*} <EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "|" <EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD>׽ӿڣ<EFBFBD><EFBFBD><EFBFBD>:
2014-11-19 00:25:21 +08:00
* /tmp/test.log|UDP:127.0.0.1:12345|TCP:127.0.0.1:12345|UNIX:/tmp/test.sock
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ͬʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> /tmp/test.log, UDP:127.0.0.1:12345,
* TCP:127.0.0.1:12345 <EFBFBD><EFBFBD> UNIX:/tmp/test.sock <EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param plog_pre {const char*} <EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>Ϣǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>ֵ
2014-11-19 00:25:21 +08:00
*/
ACL_API int acl_open_log(const char *recipients, const char *plog_pre);
/**
* <EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD> acl_open_log ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ fd <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* acl_close_on_exec<EFBFBD><EFBFBD>ȱʡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_close_on_exec
* @param yes {int} <EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> acl_close_on_exec<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
ACL_API void acl_log_close_onexec(int yes);
2014-11-19 00:25:21 +08:00
/**
* д<EFBFBD><EFBFBD>־
* @param fmt {const char*} <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param ... <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {int} д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
ACL_API int ACL_PRINTF(1, 2) acl_write_to_log(const char *fmt, ...);
/**
* д<EFBFBD><EFBFBD>־
* @param info {const char*} <EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>Ϣ
* @param fmt {const char*} <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param ap {va_list} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
* @return {int} д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
ACL_API int acl_write_to_log2(const char *info, const char *fmt, va_list ap);
/**
* <EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD>־<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
ACL_API void acl_close_log(void);
#ifdef __cplusplus
}
#endif
#endif