more yahoo ad blocking
[privoxy.git] / errlog.h
1 #ifndef ERRLOG_H_INCLUDED
2 #define ERRLOG_H_INCLUDED
3 #define ERRLOG_H_VERSION "$Id: errlog.h,v 1.21 2008/12/14 15:46:22 fabiankeil Exp $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/errlog.h,v $
7  *
8  * Purpose     :  Log errors to a designated destination in an elegant,
9  *                printf-like fashion.
10  *
11  * Copyright   :  Written by and Copyright (C) 2001-2009 the SourceForge
12  *                Privoxy team. http://www.privoxy.org/
13  *
14  *                Based on the Internet Junkbuster originally written
15  *                by and Copyright (C) 1997 Anonymous Coders and 
16  *                Junkbusters Corporation.  http://www.junkbusters.com
17  *
18  *                This program is free software; you can redistribute it 
19  *                and/or modify it under the terms of the GNU General
20  *                Public License as published by the Free Software
21  *                Foundation; either version 2 of the License, or (at
22  *                your option) any later version.
23  *
24  *                This program is distributed in the hope that it will
25  *                be useful, but WITHOUT ANY WARRANTY; without even the
26  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
27  *                PARTICULAR PURPOSE.  See the GNU General Public
28  *                License for more details.
29  *
30  *                The GNU General Public License should be included with
31  *                this file.  If not, you can view it at
32  *                http://www.gnu.org/copyleft/gpl.html
33  *                or write to the Free Software Foundation, Inc., 59
34  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
35  *
36  * Revisions   :
37  *    $Log: errlog.h,v $
38  *    Revision 1.21  2008/12/14 15:46:22  fabiankeil
39  *    Give crunched requests their own log level.
40  *
41  *    Revision 1.20  2008/03/27 18:27:23  fabiankeil
42  *    Remove kill-popups action.
43  *
44  *    Revision 1.19  2007/10/14 14:12:41  fabiankeil
45  *    When in daemon mode, close stderr after the configuration file has been
46  *    parsed the first time. If logfile isn't set, stop logging. Fixes BR#897436.
47  *
48  *    Revision 1.18  2007/07/14 07:28:47  fabiankeil
49  *    Add translation function for JB_ERR_FOO codes.
50  *
51  *    Revision 1.17  2007/03/31 13:33:28  fabiankeil
52  *    Add alternative log_error() with timestamps
53  *    that contain milliseconds and without using
54  *    strcpy(), strcat() or sprintf().
55  *
56  *    Revision 1.16  2006/11/28 15:29:50  fabiankeil
57  *    Define LOG_LEVEL_REDIRECTS independently of
58  *    FEATURE_FAST_REDIRECTS. It is used by redirect{}
59  *    as well.
60  *
61  *    Revision 1.15  2006/07/18 14:48:46  david__schmidt
62  *    Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
63  *    with what was really the latest development (the v_3_0_branch branch)
64  *
65  *    Revision 1.13.2.1  2002/08/05 17:57:06  oes
66  *    Cosmetic change
67  *
68  *    Revision 1.13  2002/03/26 22:29:54  swa
69  *    we have a new homepage!
70  *
71  *    Revision 1.12  2002/03/24 13:25:43  swa
72  *    name change related issues
73  *
74  *    Revision 1.11  2002/03/06 23:02:57  jongfoster
75  *    Removing tabs
76  *
77  *    Revision 1.10  2001/09/13 20:08:06  jongfoster
78  *    Adding support for LOG_LEVEL_CGI
79  *
80  *    Revision 1.9  2001/07/30 22:08:36  jongfoster
81  *    Tidying up #defines:
82  *    - All feature #defines are now of the form FEATURE_xxx
83  *    - Permanently turned off WIN_GUI_EDIT
84  *    - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
85  *
86  *    Revision 1.8  2001/07/29 18:43:08  jongfoster
87  *    Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
88  *    ANSI C rules.
89  *
90  *    Revision 1.7  2001/07/19 19:02:53  haroon
91  *    Added define for LOG_LEVEL_POPUPS
92  *
93  *    Revision 1.6  2001/07/13 13:59:22  oes
94  *     - Added LOG_LEVEL_DEANIMATE
95  *     - Changed LOG_LEVEL_CLF
96  *     - Removed all #ifdef PCRS
97  *
98  *    Revision 1.5  2001/05/26 17:25:14  jongfoster
99  *    Added support for CLF (Common Log Format) and fixed LOG_LEVEL_LOG
100  *
101  *    Revision 1.4  2001/05/25 21:56:06  jongfoster
102  *    Added FIXME comment to (broken) LOG_LEVEL_LOG
103  *
104  *    Revision 1.3  2001/05/22 18:46:04  oes
105  *
106  *    - Enabled filtering banners by size rather than URL
107  *      by adding patterns that replace all standard banner
108  *      sizes with the "Junkbuster" gif to the re_filterfile
109  *
110  *    - Enabled filtering WebBugs by providing a pattern
111  *      which kills all 1x1 images
112  *
113  *    - Added support for PCRE_UNGREEDY behaviour to pcrs,
114  *      which is selected by the (nonstandard and therefore
115  *      capital) letter 'U' in the option string.
116  *      It causes the quantifiers to be ungreedy by default.
117  *      Appending a ? turns back to greedy (!).
118  *
119  *    - Added a new interceptor ijb-send-banner, which
120  *      sends back the "Junkbuster" gif. Without imagelist or
121  *      MSIE detection support, or if tinygif = 1, or the
122  *      URL isn't recognized as an imageurl, a lame HTML
123  *      explanation is sent instead.
124  *
125  *    - Added new feature, which permits blocking remote
126  *      script redirects and firing back a local redirect
127  *      to the browser.
128  *      The feature is conditionally compiled, i.e. it
129  *      can be disabled with --disable-fast-redirects,
130  *      plus it must be activated by a "fast-redirects"
131  *      line in the config file, has its own log level
132  *      and of course wants to be displayed by show-proxy-args
133  *      Note: Boy, all the #ifdefs in 1001 locations and
134  *      all the fumbling with configure.in and acconfig.h
135  *      were *way* more work than the feature itself :-(
136  *
137  *    - Because a generic redirect template was needed for
138  *      this, tinygif = 3 now uses the same.
139  *
140  *    - Moved GIFs, and other static HTTP response templates
141  *      to project.h
142  *
143  *    - Some minor fixes
144  *
145  *    - Removed some >400 CRs again (Jon, you really worked
146  *      a lot! ;-)
147  *
148  *    Revision 1.2  2001/05/20 01:11:40  jongfoster
149  *    Added support for LOG_LEVEL_FATAL
150  *    Renamed LOG_LEVEL_FRC to LOG_LEVEL_FORCE,
151  *    and LOG_LEVEL_REF to LOG_LEVEL_RE_FILTER
152  *
153  *    Revision 1.1.1.1  2001/05/15 13:58:51  oes
154  *    Initial import of version 2.9.3 source tree
155  *
156  *
157  *********************************************************************/
158 \f
159
160 #ifdef __cplusplus
161 extern "C" {
162 #endif
163
164 /* Debug level for errors */
165
166 /* XXX: Should be renamed. */
167 #define LOG_LEVEL_GPC        0x0001
168 #define LOG_LEVEL_CONNECT    0x0002
169 #define LOG_LEVEL_IO         0x0004
170 #define LOG_LEVEL_HEADER     0x0008
171 #define LOG_LEVEL_LOG        0x0010
172 #ifdef FEATURE_FORCE_LOAD
173 #define LOG_LEVEL_FORCE      0x0020
174 #endif /* def FEATURE_FORCE_LOAD */
175 #define LOG_LEVEL_RE_FILTER  0x0040
176 #define LOG_LEVEL_REDIRECTS  0x0080
177 #define LOG_LEVEL_DEANIMATE  0x0100
178 #define LOG_LEVEL_CLF        0x0200 /* Common Log File format */
179 #define LOG_LEVEL_CRUNCH     0x0400
180 #define LOG_LEVEL_CGI        0x0800 /* CGI / templates */
181
182 /* Following are always on: */
183 #define LOG_LEVEL_INFO    0x1000
184 #define LOG_LEVEL_ERROR   0x2000
185 #define LOG_LEVEL_FATAL   0x4000 /* Exits after writing log */
186
187 extern void init_error_log(const char *prog_name, const char *logfname);
188 extern void set_debug_level(int debuglevel);
189 extern void disable_logging(void);
190 extern void init_log_module(void);
191 extern void show_version(const char *prog_name);
192 extern void log_error(int loglevel, const char *fmt, ...);
193 extern const char *jb_err_to_string(int error);
194
195 /* Revision control strings from this header and associated .c file */
196 extern const char errlog_rcs[];
197 extern const char errlog_h_rcs[];
198
199 #ifdef __cplusplus
200 } /* extern "C" */
201 #endif
202
203 #endif /* ndef ERRLOG_H_INCLUDED */
204
205 /*
206   Local Variables:
207   tab-width: 3
208   end:
209 */
210