Annotation of win32/apache13/src/include/http_log.h, revision 1.1.1.1
1.1 parser 1: /* ====================================================================
2: * Copyright (c) 1995-1999 The Apache Group. All rights reserved.
3: *
4: * Redistribution and use in source and binary forms, with or without
5: * modification, are permitted provided that the following conditions
6: * are met:
7: *
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: *
11: * 2. Redistributions in binary form must reproduce the above copyright
12: * notice, this list of conditions and the following disclaimer in
13: * the documentation and/or other materials provided with the
14: * distribution.
15: *
16: * 3. All advertising materials mentioning features or use of this
17: * software must display the following acknowledgment:
18: * "This product includes software developed by the Apache Group
19: * for use in the Apache HTTP server project (http://www.apache.org/)."
20: *
21: * 4. The names "Apache Server" and "Apache Group" must not be used to
22: * endorse or promote products derived from this software without
23: * prior written permission. For written permission, please contact
24: * apache@apache.org.
25: *
26: * 5. Products derived from this software may not be called "Apache"
27: * nor may "Apache" appear in their names without prior written
28: * permission of the Apache Group.
29: *
30: * 6. Redistributions of any form whatsoever must retain the following
31: * acknowledgment:
32: * "This product includes software developed by the Apache Group
33: * for use in the Apache HTTP server project (http://www.apache.org/)."
34: *
35: * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
36: * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
39: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46: * OF THE POSSIBILITY OF SUCH DAMAGE.
47: * ====================================================================
48: *
49: * This software consists of voluntary contributions made by many
50: * individuals on behalf of the Apache Group and was originally based
51: * on public domain software written at the National Center for
52: * Supercomputing Applications, University of Illinois, Urbana-Champaign.
53: * For more information on the Apache Group and the Apache HTTP server
54: * project, please see <http://www.apache.org/>.
55: *
56: */
57:
58: #ifndef APACHE_HTTP_LOG_H
59: #define APACHE_HTTP_LOG_H
60:
61: #ifdef __cplusplus
62: extern "C" {
63: #endif
64:
65: #ifdef HAVE_SYSLOG
66: #include <syslog.h>
67:
68: #define APLOG_EMERG LOG_EMERG /* system is unusable */
69: #define APLOG_ALERT LOG_ALERT /* action must be taken immediately */
70: #define APLOG_CRIT LOG_CRIT /* critical conditions */
71: #define APLOG_ERR LOG_ERR /* error conditions */
72: #define APLOG_WARNING LOG_WARNING /* warning conditions */
73: #define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */
74: #define APLOG_INFO LOG_INFO /* informational */
75: #define APLOG_DEBUG LOG_DEBUG /* debug-level messages */
76:
77: #define APLOG_LEVELMASK LOG_PRIMASK /* mask off the level value */
78:
79: #else
80:
81: #define APLOG_EMERG 0 /* system is unusable */
82: #define APLOG_ALERT 1 /* action must be taken immediately */
83: #define APLOG_CRIT 2 /* critical conditions */
84: #define APLOG_ERR 3 /* error conditions */
85: #define APLOG_WARNING 4 /* warning conditions */
86: #define APLOG_NOTICE 5 /* normal but significant condition */
87: #define APLOG_INFO 6 /* informational */
88: #define APLOG_DEBUG 7 /* debug-level messages */
89:
90: #define APLOG_LEVELMASK 7 /* mask off the level value */
91:
92: #endif
93:
94: #define APLOG_NOERRNO (APLOG_LEVELMASK + 1)
95: #ifdef WIN32
96: /* Set to indicate that error msg should come from Win32's GetLastError(),
97: * not errno. */
98: #define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2)
99: #endif
100:
101: #ifndef DEFAULT_LOGLEVEL
102: #define DEFAULT_LOGLEVEL APLOG_WARNING
103: #endif
104:
105: #define APLOG_MARK __FILE__,__LINE__
106:
107: void ap_open_logs (server_rec *, pool *p);
108:
109: /* The two primary logging functions, ap_log_error and ap_log_rerror,
110: * use a printf style format string to build the log message. It is
111: * VERY IMPORTANT that you not include any raw data from the network,
112: * such as the request-URI or request header fields, within the format
113: * string. Doing so makes the server vulnerable to a denial-of-service
114: * attack and other messy behavior. Instead, use a simple format string
115: * like "%s", followed by the string containing the untrusted data.
116: */
117: API_EXPORT(void) ap_log_error(const char *file, int line, int level,
118: const server_rec *s, const char *fmt, ...)
119: __attribute__((format(printf,5,6)));
120: API_EXPORT(void) ap_log_rerror(const char *file, int line, int level,
121: const request_rec *s, const char *fmt, ...)
122: __attribute__((format(printf,5,6)));
123: API_EXPORT(void) ap_error_log2stderr (server_rec *);
124:
125: void ap_log_pid (pool *p, char *fname);
126: /* These are for legacy code, new code should use ap_log_error,
127: * or ap_log_rerror.
128: */
129: API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s);
130: API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
131: const char *msg, server_rec *s);
132: API_EXPORT(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
133: __attribute__((format(printf,2,3)));
134: API_EXPORT(void) ap_log_reason(const char *reason, const char *fname,
135: request_rec *r);
136:
137: typedef struct piped_log {
138: pool *p;
139: #if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF)
140: char *program;
141: int pid;
142: int fds[2];
143: #else
144: FILE *write_f;
145: #endif
146: } piped_log;
147:
148: API_EXPORT(piped_log *) ap_open_piped_log (pool *p, const char *program);
149: API_EXPORT(void) ap_close_piped_log (piped_log *);
150: #if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF)
151: #define ap_piped_log_read_fd(pl) ((pl)->fds[0])
152: #define ap_piped_log_write_fd(pl) ((pl)->fds[1])
153: #else
154: #define ap_piped_log_read_fd(pl) (-1)
155: #define ap_piped_log_write_fd(pl) (fileno((pl)->write_f))
156: #endif
157:
158: #ifdef __cplusplus
159: }
160: #endif
161:
162: #endif /* !APACHE_HTTP_LOG_H */
E-mail: