00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00026 #ifndef APACHE_HTTP_LOG_H
00027 #define APACHE_HTTP_LOG_H
00028
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032
00033 #include "apr_thread_proc.h"
00034
00035 #ifdef HAVE_SYSLOG
00036 #include <syslog.h>
00037
00038 #ifndef LOG_PRIMASK
00039 #define LOG_PRIMASK 7
00040 #endif
00041
00042 #define APLOG_EMERG LOG_EMERG
00043 #define APLOG_ALERT LOG_ALERT
00044 #define APLOG_CRIT LOG_CRIT
00045 #define APLOG_ERR LOG_ERR
00046 #define APLOG_WARNING LOG_WARNING
00047 #define APLOG_NOTICE LOG_NOTICE
00048 #define APLOG_INFO LOG_INFO
00049 #define APLOG_DEBUG LOG_DEBUG
00050
00051 #define APLOG_LEVELMASK LOG_PRIMASK
00052
00053 #else
00054
00055 #define APLOG_EMERG 0
00056 #define APLOG_ALERT 1
00057 #define APLOG_CRIT 2
00058 #define APLOG_ERR 3
00059 #define APLOG_WARNING 4
00060 #define APLOG_NOTICE 5
00061 #define APLOG_INFO 6
00062 #define APLOG_DEBUG 7
00063
00064 #define APLOG_LEVELMASK 7
00065
00066 #endif
00067
00068
00069
00070
00071 #define APLOG_NOERRNO (APLOG_LEVELMASK + 1)
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 #define APLOG_TOCLIENT ((APLOG_LEVELMASK + 1) * 2)
00086
00087
00088 #define APLOG_STARTUP ((APLOG_LEVELMASK + 1) * 4)
00089
00090 #ifndef DEFAULT_LOGLEVEL
00091 #define DEFAULT_LOGLEVEL APLOG_WARNING
00092 #endif
00093
00094 extern int AP_DECLARE_DATA ap_default_loglevel;
00095
00096 #define APLOG_MARK __FILE__,__LINE__
00097
00102 AP_DECLARE(void) ap_open_stderr_log(apr_pool_t *p);
00103
00109 AP_DECLARE(apr_status_t) ap_replace_stderr_log(apr_pool_t *p,
00110 const char *file);
00111
00121 int ap_open_logs(apr_pool_t *pconf, apr_pool_t *plog,
00122 apr_pool_t *ptemp, server_rec *s_main);
00123
00124 #ifdef CORE_PRIVATE
00125
00134 void ap_logs_child_init(apr_pool_t *p, server_rec *s);
00135
00136 #endif
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00171 AP_DECLARE(void) ap_log_error(const char *file, int line, int level,
00172 apr_status_t status, const server_rec *s,
00173 const char *fmt, ...)
00174 __attribute__((format(printf,6,7)));
00175
00195 AP_DECLARE(void) ap_log_perror(const char *file, int line, int level,
00196 apr_status_t status, apr_pool_t *p,
00197 const char *fmt, ...)
00198 __attribute__((format(printf,6,7)));
00199
00219 AP_DECLARE(void) ap_log_rerror(const char *file, int line, int level,
00220 apr_status_t status, const request_rec *r,
00221 const char *fmt, ...)
00222 __attribute__((format(printf,6,7)));
00223
00245 AP_DECLARE(void) ap_log_cerror(const char *file, int line, int level,
00246 apr_status_t status, const conn_rec *c,
00247 const char *fmt, ...)
00248 __attribute__((format(printf,6,7)));
00249
00254 AP_DECLARE(void) ap_error_log2stderr(server_rec *s);
00255
00261 AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname);
00262
00269 AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename, pid_t *mypid);
00270
00272 typedef struct piped_log piped_log;
00273
00280 struct piped_log {
00282 apr_pool_t *p;
00284 apr_file_t *fds[2];
00285
00286
00287 #ifdef AP_HAVE_RELIABLE_PIPED_LOGS
00288
00289 char *program;
00291 apr_proc_t *pid;
00292 #endif
00293 };
00294
00301 AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program);
00302
00307 AP_DECLARE(void) ap_close_piped_log(piped_log *pl);
00308
00314 #define ap_piped_log_read_fd(pl) ((pl)->fds[0])
00315
00321 #define ap_piped_log_write_fd(pl) ((pl)->fds[1])
00322
00335 AP_DECLARE_HOOK(void, error_log, (const char *file, int line, int level,
00336 apr_status_t status, const server_rec *s,
00337 const request_rec *r, apr_pool_t *pool,
00338 const char *errstr))
00339
00340 #ifdef __cplusplus
00341 }
00342 #endif
00343
00344 #endif
00345