http_log.h

#ifndef APACHE_HTTP_LOG_H
#define APACHE_HTTP_LOG_H

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_SYSLOG
#include <syslog.h>

#define APLOG_EMERG     LOG_EMERG     /* system is unusable */
#define APLOG_ALERT     LOG_ALERT     /* action must be taken immediately */
#define APLOG_CRIT      LOG_CRIT      /* critical conditions */
#define APLOG_ERR       LOG_ERR       /* error conditions */
#define APLOG_WARNING   LOG_WARNING   /* warning conditions */
#define APLOG_NOTICE    LOG_NOTICE    /* normal but significant condition */
#define APLOG_INFO      LOG_INFO      /* informational */
#define APLOG_DEBUG     LOG_DEBUG     /* debug-level messages */

#define APLOG_LEVELMASK LOG_PRIMASK   /* mask off the level value */

#else

#define APLOG_EMERG 0 /* system is unusable */
#define APLOG_ALERT 1 /* action must be taken immediately */
#define APLOG_CRIT 2 /* critical conditions */
#define APLOG_ERR 3 /* error conditions */
#define APLOG_WARNING 4 /* warning conditions */
#define APLOG_NOTICE 5 /* normal but significant condition */
#define APLOG_INFO 6 /* informational */
#define APLOG_DEBUG 7 /* debug-level messages */

#define APLOG_LEVELMASK 7 /* mask off the level value */

#endif

#define APLOG_NOERRNO  (APLOG_LEVELMASK + 1)
#ifdef WIN32
/* Set to indicate that error msg should come from Win32's GetLastError(),
 * not errno. */
#define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2)
#endif

#ifndef DEFAULT_LOGLEVEL
#define DEFAULT_LOGLEVEL APLOG_WARNING
#endif

#define APLOG_MARK __FILE__,__LINE__

void ap_open_logs (server_rec *, pool *p);
API_EXPORT(void) ap_log_error(const char *file, int line, int level,
        const server_rec *s, const char *fmt, ...)
       __attribute__((format(printf,5,6)));
API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
        const request_rec *s, const char *fmt, ...)
       __attribute__((format(printf,5,6)));
API_EXPORT(void) ap_error_log2stderr (server_rec *);    

void ap_log_pid (pool *p, char *fname);
/* These are for legacy code, new code should use ap_log_error,
 * or ap_log_rerror.
 */
API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s);
API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
        const char *msg, server_rec *s);
API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
       __attribute__((format(printf,2,3)));
API_EXPORT(void) ap_log_reason(const char *reason, const char *fname,
       request_rec *r);

typedef struct piped_log {
    pool *p;
#ifndef NO_RELIABLE_PIPED_LOGS
    char *program;
    int pid;
    int fds[2];
#else
    FILE *write_f;
#endif
} piped_log;

API_EXPORT(piped_log *) ap_open_piped_log (pool *p, const char *program);
API_EXPORT(void) ap_close_piped_log (piped_log *);
#ifndef NO_RELIABLE_PIPED_LOGS
#define ap_piped_log_read_fd(pl) ((pl)->fds[0])
#define ap_piped_log_write_fd(pl) ((pl)->fds[1])
#else
#define ap_piped_log_read_fd(pl) (-1)
#define ap_piped_log_write_fd(pl) (fileno((pl)->write_f))
#endif

#ifdef __cplusplus
}
#endif

#endif /* !APACHE_HTTP_LOG_H */
该文件定义了日志文件的api函数。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值