Mercurial > hg > nginx-quic
annotate src/core/ngx_log.h @ 6133:af7eba90645d
Win32: shared memory base addresses and remapping.
Two mechanisms are implemented to make it possible to store pointers
in shared memory on Windows, in particular on Windows Vista and later
versions with ASLR:
- The ngx_shm_remap() function added to allow remapping of a shared memory
zone to the address originally used for it in the master process. While
important, it doesn't solve the problem by itself as in many cases it's
not possible to use the address because of conflicts with other
allocations.
- We now create mappings at the same address in all processes by starting
mappings at predefined addresses normally unused by newborn processes.
These two mechanisms combined allow to use shared memory on Windows
almost without problems, including reloads.
Based on the patch by Sergey Brester:
http://mailman.nginx.org/pipermail/nginx-devel/2015-April/006836.html
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 27 Apr 2015 18:25:42 +0300 |
parents | 61d7ae76647d |
children | e034af368274 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
7 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #ifndef _NGX_LOG_H_INCLUDED_ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #define _NGX_LOG_H_INCLUDED_ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
12 #include <ngx_config.h> |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
13 #include <ngx_core.h> |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
14 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
16 #define NGX_LOG_STDERR 0 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
17 #define NGX_LOG_EMERG 1 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
18 #define NGX_LOG_ALERT 2 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
19 #define NGX_LOG_CRIT 3 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
20 #define NGX_LOG_ERR 4 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
21 #define NGX_LOG_WARN 5 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
22 #define NGX_LOG_NOTICE 6 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
23 #define NGX_LOG_INFO 7 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
24 #define NGX_LOG_DEBUG 8 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
25 |
379
73688d5d7fc3
nginx-0.0.7-2004-07-06-20:12:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
26 #define NGX_LOG_DEBUG_CORE 0x010 |
73688d5d7fc3
nginx-0.0.7-2004-07-06-20:12:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
27 #define NGX_LOG_DEBUG_ALLOC 0x020 |
73688d5d7fc3
nginx-0.0.7-2004-07-06-20:12:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
28 #define NGX_LOG_DEBUG_MUTEX 0x040 |
73688d5d7fc3
nginx-0.0.7-2004-07-06-20:12:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
29 #define NGX_LOG_DEBUG_EVENT 0x080 |
73688d5d7fc3
nginx-0.0.7-2004-07-06-20:12:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
307
diff
changeset
|
30 #define NGX_LOG_DEBUG_HTTP 0x100 |
1136 | 31 #define NGX_LOG_DEBUG_MAIL 0x200 |
645 | 32 #define NGX_LOG_DEBUG_MYSQL 0x400 |
6115 | 33 #define NGX_LOG_DEBUG_STREAM 0x800 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
389
diff
changeset
|
34 |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
389
diff
changeset
|
35 /* |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
36 * do not forget to update debug_levels[] in src/core/ngx_log.c |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
426
diff
changeset
|
37 * after the adding a new debug level |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
389
diff
changeset
|
38 */ |
208
0b67be7d4489
nginx-0.0.1-2003-12-08-23:48:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
201
diff
changeset
|
39 |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
40 #define NGX_LOG_DEBUG_FIRST NGX_LOG_DEBUG_CORE |
6115 | 41 #define NGX_LOG_DEBUG_LAST NGX_LOG_DEBUG_STREAM |
307
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
42 #define NGX_LOG_DEBUG_CONNECTION 0x80000000 |
ce375c313e96
nginx-0.0.3-2004-04-08-19:58:25 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
43 #define NGX_LOG_DEBUG_ALL 0x7ffffff0 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
44 |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
45 |
483 | 46 typedef u_char *(*ngx_log_handler_pt) (ngx_log_t *log, u_char *buf, size_t len); |
5702
777202558122
Added syslog support for error_log and access_log directives.
Vladimir Homutov <vl@nginx.com>
parents:
5260
diff
changeset
|
47 typedef void (*ngx_log_writer_pt) (ngx_log_t *log, ngx_uint_t level, |
777202558122
Added syslog support for error_log and access_log directives.
Vladimir Homutov <vl@nginx.com>
parents:
5260
diff
changeset
|
48 u_char *buf, size_t len); |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
49 |
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
50 |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
51 struct ngx_log_s { |
257
70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
234
diff
changeset
|
52 ngx_uint_t log_level; |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
53 ngx_open_file_t *file; |
483 | 54 |
495 | 55 ngx_atomic_uint_t connection; |
483 | 56 |
5962
727177743c3c
Core: added disk_full_time checks to error log.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5763
diff
changeset
|
57 time_t disk_full_time; |
727177743c3c
Core: added disk_full_time checks to error log.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5763
diff
changeset
|
58 |
483 | 59 ngx_log_handler_pt handler; |
160
e7e094d34162
nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
60 void *data; |
483 | 61 |
5702
777202558122
Added syslog support for error_log and access_log directives.
Vladimir Homutov <vl@nginx.com>
parents:
5260
diff
changeset
|
62 ngx_log_writer_pt writer; |
777202558122
Added syslog support for error_log and access_log directives.
Vladimir Homutov <vl@nginx.com>
parents:
5260
diff
changeset
|
63 void *wdata; |
777202558122
Added syslog support for error_log and access_log directives.
Vladimir Homutov <vl@nginx.com>
parents:
5260
diff
changeset
|
64 |
483 | 65 /* |
66 * we declare "action" as "char *" because the actions are usually | |
67 * the static strings and in the "u_char *" case we have to override | |
68 * their types all the time | |
69 */ | |
70 | |
71 char *action; | |
5254
7ecaa9e4bf1b
Core: support several "error_log" directives.
Vladimir Homutov <vl@nginx.com>
parents:
4412
diff
changeset
|
72 |
7ecaa9e4bf1b
Core: support several "error_log" directives.
Vladimir Homutov <vl@nginx.com>
parents:
4412
diff
changeset
|
73 ngx_log_t *next; |
191
71ce40b3c37b
nginx-0.0.1-2003-11-19-19:26:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
186
diff
changeset
|
74 }; |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
75 |
461 | 76 |
77 #define NGX_MAX_ERROR_STR 2048 | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
78 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
79 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
80 /*********************************/ |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
81 |
3673
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
82 #if (NGX_HAVE_C99_VARIADIC_MACROS) |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
83 |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
84 #define NGX_HAVE_VARIADIC_MACROS 1 |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
85 |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
86 #define ngx_log_error(level, log, ...) \ |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
87 if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__) |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
88 |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
89 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
90 const char *fmt, ...); |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
91 |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
92 #define ngx_log_debug(level, log, ...) \ |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
93 if ((log)->log_level & level) \ |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
94 ngx_log_error_core(NGX_LOG_DEBUG, log, __VA_ARGS__) |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
95 |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
96 /*********************************/ |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
97 |
e27070fb6c6b
try to use C99 variadic macros first:
Igor Sysoev <igor@sysoev.ru>
parents:
2785
diff
changeset
|
98 #elif (NGX_HAVE_GCC_VARIADIC_MACROS) |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
99 |
455 | 100 #define NGX_HAVE_VARIADIC_MACROS 1 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
101 |
483 | 102 #define ngx_log_error(level, log, args...) \ |
543 | 103 if ((log)->log_level >= level) ngx_log_error_core(level, log, args) |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
104 |
278
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
277
diff
changeset
|
105 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, |
499 | 106 const char *fmt, ...); |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
107 |
483 | 108 #define ngx_log_debug(level, log, args...) \ |
543 | 109 if ((log)->log_level & level) \ |
483 | 110 ngx_log_error_core(NGX_LOG_DEBUG, log, args) |
111 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
112 /*********************************/ |
92
19cc647ecd91
nginx-0.0.1-2003-05-20-19:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
113 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
114 #else /* NO VARIADIC MACROS */ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
115 |
455 | 116 #define NGX_HAVE_VARIADIC_MACROS 0 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
117 |
503 | 118 void ngx_cdecl ngx_log_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, |
499 | 119 const char *fmt, ...); |
278
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
277
diff
changeset
|
120 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, |
499 | 121 const char *fmt, va_list args); |
503 | 122 void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err, |
123 const char *fmt, ...); | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
124 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
125 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
126 #endif /* VARIADIC MACROS */ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
127 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
128 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
129 /*********************************/ |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
130 |
277
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
131 #if (NGX_DEBUG) |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
132 |
455 | 133 #if (NGX_HAVE_VARIADIC_MACROS) |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
134 |
4397
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
135 #define ngx_log_debug0(level, log, err, fmt) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
136 ngx_log_debug(level, log, err, fmt) |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
137 |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
138 #define ngx_log_debug1(level, log, err, fmt, arg1) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
139 ngx_log_debug(level, log, err, fmt, arg1) |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
140 |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
141 #define ngx_log_debug2(level, log, err, fmt, arg1, arg2) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
142 ngx_log_debug(level, log, err, fmt, arg1, arg2) |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
143 |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
144 #define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
145 ngx_log_debug(level, log, err, fmt, arg1, arg2, arg3) |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
146 |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
147 #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
148 ngx_log_debug(level, log, err, fmt, arg1, arg2, arg3, arg4) |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
149 |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
150 #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
151 ngx_log_debug(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
152 |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
153 #define ngx_log_debug6(level, log, err, fmt, \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
154 arg1, arg2, arg3, arg4, arg5, arg6) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
155 ngx_log_debug(level, log, err, fmt, \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
156 arg1, arg2, arg3, arg4, arg5, arg6) |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
157 |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
158 #define ngx_log_debug7(level, log, err, fmt, \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
159 arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
160 ngx_log_debug(level, log, err, fmt, \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
161 arg1, arg2, arg3, arg4, arg5, arg6, arg7) |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
162 |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
163 #define ngx_log_debug8(level, log, err, fmt, \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
164 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
165 ngx_log_debug(level, log, err, fmt, \ |
d3000365ac65
Changed ngx_log_debugN() macros to verify the number of arguments
Ruslan Ermilov <ru@nginx.com>
parents:
4283
diff
changeset
|
166 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) |
389
537de4dca8ca
nginx-0.0.7-2004-07-13-21:59:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
379
diff
changeset
|
167 |
515 | 168 |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
169 #else /* NO VARIADIC MACROS */ |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
170 |
483 | 171 #define ngx_log_debug0(level, log, err, fmt) \ |
543 | 172 if ((log)->log_level & level) \ |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
173 ngx_log_debug_core(log, err, fmt) |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
174 |
483 | 175 #define ngx_log_debug1(level, log, err, fmt, arg1) \ |
543 | 176 if ((log)->log_level & level) \ |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
177 ngx_log_debug_core(log, err, fmt, arg1) |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
178 |
483 | 179 #define ngx_log_debug2(level, log, err, fmt, arg1, arg2) \ |
543 | 180 if ((log)->log_level & level) \ |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
181 ngx_log_debug_core(log, err, fmt, arg1, arg2) |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
182 |
483 | 183 #define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) \ |
543 | 184 if ((log)->log_level & level) \ |
213
f536f91e8e99
nginx-0.0.1-2003-12-19-15:45:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
185 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3) |
f536f91e8e99
nginx-0.0.1-2003-12-19-15:45:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
186 |
483 | 187 #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \ |
543 | 188 if ((log)->log_level & level) \ |
214
e0c502f15852
nginx-0.0.1-2003-12-22-12:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
213
diff
changeset
|
189 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4) |
e0c502f15852
nginx-0.0.1-2003-12-22-12:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
213
diff
changeset
|
190 |
483 | 191 #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \ |
543 | 192 if ((log)->log_level & level) \ |
214
e0c502f15852
nginx-0.0.1-2003-12-22-12:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
213
diff
changeset
|
193 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5) |
e0c502f15852
nginx-0.0.1-2003-12-22-12:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
213
diff
changeset
|
194 |
483 | 195 #define ngx_log_debug6(level, log, err, fmt, \ |
196 arg1, arg2, arg3, arg4, arg5, arg6) \ | |
543 | 197 if ((log)->log_level & level) \ |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
198 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6) |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
208
diff
changeset
|
199 |
483 | 200 #define ngx_log_debug7(level, log, err, fmt, \ |
201 arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ | |
543 | 202 if ((log)->log_level & level) \ |
483 | 203 ngx_log_debug_core(log, err, fmt, \ |
389
537de4dca8ca
nginx-0.0.7-2004-07-13-21:59:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
379
diff
changeset
|
204 arg1, arg2, arg3, arg4, arg5, arg6, arg7) |
537de4dca8ca
nginx-0.0.7-2004-07-13-21:59:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
379
diff
changeset
|
205 |
483 | 206 #define ngx_log_debug8(level, log, err, fmt, \ |
207 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ | |
543 | 208 if ((log)->log_level & level) \ |
483 | 209 ngx_log_debug_core(log, err, fmt, \ |
210 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) | |
211 | |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
212 #endif |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
213 |
277
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
214 #else /* NO NGX_DEBUG */ |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
215 |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
216 #define ngx_log_debug0(level, log, err, fmt) |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
217 #define ngx_log_debug1(level, log, err, fmt, arg1) |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
218 #define ngx_log_debug2(level, log, err, fmt, arg1, arg2) |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
219 #define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
220 #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
221 #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
222 #define ngx_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6) |
426
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
223 #define ngx_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, \ |
3f88935a02e8
nginx-0.0.10-2004-09-14-23:39:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
224 arg6, arg7) |
483 | 225 #define ngx_log_debug8(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, \ |
226 arg6, arg7, arg8) | |
277
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
227 |
e91499541410
nginx-0.0.2-2004-03-03-19:14:15 import
Igor Sysoev <igor@sysoev.ru>
parents:
257
diff
changeset
|
228 #endif |
201
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
229 |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
230 /*********************************/ |
267ea1d98683
nginx-0.0.1-2003-11-30-23:03:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
191
diff
changeset
|
231 |
2758 | 232 ngx_log_t *ngx_log_init(u_char *prefix); |
2752
2d82d3cfbfa0
change ngx_log_abort() interface
Igor Sysoev <igor@sysoev.ru>
parents:
2749
diff
changeset
|
233 void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...); |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2722
diff
changeset
|
234 void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...); |
2765 | 235 u_char *ngx_log_errno(u_char *buf, u_char *last, ngx_err_t err); |
5260
e088695737c3
Core: consolidated log-related code.
Vladimir Homutov <vl@nginx.com>
parents:
5254
diff
changeset
|
236 ngx_int_t ngx_log_open_default(ngx_cycle_t *cycle); |
e088695737c3
Core: consolidated log-related code.
Vladimir Homutov <vl@nginx.com>
parents:
5254
diff
changeset
|
237 ngx_int_t ngx_log_redirect_stderr(ngx_cycle_t *cycle); |
5702
777202558122
Added syslog support for error_log and access_log directives.
Vladimir Homutov <vl@nginx.com>
parents:
5260
diff
changeset
|
238 ngx_log_t *ngx_log_get_file_log(ngx_log_t *head); |
5254
7ecaa9e4bf1b
Core: support several "error_log" directives.
Vladimir Homutov <vl@nginx.com>
parents:
4412
diff
changeset
|
239 char *ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head); |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
240 |
109
a9bc21d63fe4
nginx-0.0.1-2003-07-02-18:41:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
241 |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
242 /* |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
243 * ngx_write_stderr() cannot be implemented as macro, since |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
244 * MSVC does not allow to use #ifdef inside macro parameters. |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
245 * |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
246 * ngx_write_fd() is used instead of ngx_write_console(), since |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
247 * CharToOemBuff() inside ngx_write_console() cannot be used with |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
248 * read only buffer as destination and CharToOemBuff() is not needed |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
249 * for ngx_write_stderr() anyway. |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
250 */ |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
251 static ngx_inline void |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
252 ngx_write_stderr(char *text) |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
253 { |
5763
09e734739e46
Style: use ngx_strlen() instead of strlen().
Tatsuhiko Kubo <cubicdaiya@gmail.com>
parents:
5702
diff
changeset
|
254 (void) ngx_write_fd(ngx_stderr, text, ngx_strlen(text)); |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
255 } |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
256 |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3673
diff
changeset
|
257 |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
258 extern ngx_module_t ngx_errlog_module; |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2722
diff
changeset
|
259 extern ngx_uint_t ngx_use_stderr; |
100
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
260 |
7ebc8b7fb816
nginx-0.0.1-2003-06-03-19:42:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
261 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
262 #endif /* _NGX_LOG_H_INCLUDED_ */ |