1 2 /* TODO : fix the conf_log macros */ 3 4 #define NGX_LOG_DEBUG_SCRIPT NGX_LOG_DEBUG_HTTP /* TODO : add new section to log/conf directives */ 5 6 #define ndk_conf_to_log(cf) ((cf)->log) 7 8 #ifndef ndk_request_to_log 9 #define ndk_request_to_log(r) ((r)->connection->log) 10 #endif 11 12 13 /*********************************/ 14 15 #if (NGX_HAVE_C99_VARIADIC_MACROS) 16 17 #define ndk_log_stderr(log,...) ngx_log_error (NGX_LOG_STDERR, log, 0, __VA_ARGS__) 18 #define ndk_log_emerg(log,...) ngx_log_error (NGX_LOG_EMERG, log, 0, __VA_ARGS__) 19 #define ndk_log_alert(log,...) ngx_log_error (NGX_LOG_ALERT, log, 0, __VA_ARGS__) 20 #define ndk_log_crit(log,...) ngx_log_error (NGX_LOG_CRIT, log, 0, __VA_ARGS__) 21 #define ndk_log_err(log,...) ngx_log_error (NGX_LOG_ERR, log, 0, __VA_ARGS__) 22 #define ndk_log_warning(log,...) ngx_log_error (NGX_LOG_WARN, log, 0, __VA_ARGS__) 23 #define ndk_log_notice(log,...) ngx_log_error (NGX_LOG_NOTICE, log, 0, __VA_ARGS__) 24 #define ndk_log_info(log,...) ngx_log_error (NGX_LOG_INFO, log, 0, __VA_ARGS__) 25 26 #define ndk_conf_log_stderr(cf,...) ngx_conf_log_error (NGX_LOG_STDERR, cf, 0, __VA_ARGS__) 27 #define ndk_conf_log_emerg(cf,...) ngx_conf_log_error (NGX_LOG_EMERG, cf, 0, __VA_ARGS__) 28 #define ndk_conf_log_alert(cf,...) ngx_conf_log_error (NGX_LOG_ALERT, cf, 0, __VA_ARGS__) 29 #define ndk_conf_log_crit(cf,...) ngx_conf_log_error (NGX_LOG_CRIT, cf, 0, __VA_ARGS__) 30 #define ndk_conf_log_err(cf,...) ngx_conf_log_error (NGX_LOG_ERR, cf, 0, __VA_ARGS__) 31 #define ndk_conf_log_warning(cf,...) ngx_conf_log_error (NGX_LOG_WARN, cf, 0, __VA_ARGS__) 32 #define ndk_conf_log_notice(cf,...) ngx_conf_log_error (NGX_LOG_NOTICE, cf, 0, __VA_ARGS__) 33 #define ndk_conf_log_info(cf,...) ngx_conf_log_error (NGX_LOG_INFO, cf, 0, __VA_ARGS__) 34 35 #define ndk_request_log_stderr(r,...) ndk_log_stderr (ndk_request_to_log(r), __VA_ARGS__) 36 #define ndk_request_log_emerg(r,...) ndk_log_emerg (ndk_request_to_log(r), __VA_ARGS__) 37 #define ndk_request_log_alert(r,...) ndk_log_alert (ndk_request_to_log(r), __VA_ARGS__) 38 #define ndk_request_log_crit(r,...) ndk_log_crit (ndk_request_to_log(r), __VA_ARGS__) 39 #define ndk_request_log_err(r,...) ndk_log_err (ndk_request_to_log(r), __VA_ARGS__) 40 #define ndk_request_log_warning(r,...) ndk_log_warning (ndk_request_to_log(r), __VA_ARGS__) 41 #define ndk_request_log_notice(r,...) ndk_log_notice (ndk_request_to_log(r), __VA_ARGS__) 42 #define ndk_request_log_info(r,...) ndk_log_info (ndk_request_to_log(r), __VA_ARGS__) 43 44 45 #if (NGX_DEBUG) 46 47 #define ndk_log_debug_core(log,...) ngx_log_debug (NGX_LOG_DEBUG_CORE, log, 0, __VA_ARGS__) 48 #define ndk_log_debug_alloc(log,...) ngx_log_debug (NGX_LOG_DEBUG_ALLOC, log, 0, __VA_ARGS__) 49 #define ndk_log_debug_mutex(log,...) ngx_log_debug (NGX_LOG_DEBUG_MUTEX, log, 0, __VA_ARGS__) 50 #define ndk_log_debug_event(log,...) ngx_log_debug (NGX_LOG_DEBUG_EVENT, log, 0, __VA_ARGS__) 51 #define ndk_log_debug_http(log,...) ngx_log_debug (NGX_LOG_DEBUG_HTTP, log, 0, __VA_ARGS__) 52 #define ndk_log_debug_mail(log,...) ngx_log_debug (NGX_LOG_DEBUG_MAIL, log, 0, __VA_ARGS__) 53 #define ndk_log_debug_mysql(log,...) ngx_log_debug (NGX_LOG_DEBUG_MYSQL, log, 0, __VA_ARGS__) 54 55 #define ndk_conf_log_debug_core(r,...) ndk_log_debug_core (ndk_conf_to_log(r), __VA_ARGS__) 56 #define ndk_conf_log_debug_alloc(r,...) ndk_log_debug_alloc (ndk_conf_to_log(r), __VA_ARGS__) 57 #define ndk_conf_log_debug_mutex(r,...) ndk_log_debug_mutex (ndk_conf_to_log(r), __VA_ARGS__) 58 #define ndk_conf_log_debug_event(r,...) ndk_log_debug_event (ndk_conf_to_log(r), __VA_ARGS__) 59 #define ndk_conf_log_debug_http(r,...) ndk_log_debug_http (ndk_conf_to_log(r), __VA_ARGS__) 60 #define ndk_conf_log_debug_mail(r,...) ndk_log_debug_mail (ndk_conf_to_log(r), __VA_ARGS__) 61 #define ndk_conf_log_debug_mysql(r,...) ndk_log_debug_mysql (ndk_conf_to_log(r), __VA_ARGS__) 62 63 #define ndk_request_log_debug_core(r,...) ndk_log_debug_core (ndk_request_to_log(r), __VA_ARGS__) 64 #define ndk_request_log_debug_alloc(r,...) ndk_log_debug_alloc (ndk_request_to_log(r), __VA_ARGS__) 65 #define ndk_request_log_debug_mutex(r,...) ndk_log_debug_mutex (ndk_request_to_log(r), __VA_ARGS__) 66 #define ndk_request_log_debug_event(r,...) ndk_log_debug_event (ndk_request_to_log(r), __VA_ARGS__) 67 #define ndk_request_log_debug_http(r,...) ndk_log_debug_http (ndk_request_to_log(r), __VA_ARGS__) 68 #define ndk_request_log_debug_mail(r,...) ndk_log_debug_mail (ndk_request_to_log(r), __VA_ARGS__) 69 #define ndk_request_log_debug_mysql(r,...) ndk_log_debug_mysql (ndk_request_to_log(r), __VA_ARGS__) 70 71 #else 72 73 #define ndk_log_debug_core(log,...) 74 #define ndk_log_debug_alloc(log,...) 75 #define ndk_log_debug_mutex(log,...) 76 #define ndk_log_debug_event(log,...) 77 #define ndk_log_debug_http(log,...) 78 #define ndk_log_debug_mail(log,...) 79 #define ndk_log_debug_mysql(log,...) 80 81 #define ndk_conf_log_debug_core(r,...) 82 #define ndk_conf_log_debug_alloc(r,...) 83 #define ndk_conf_log_debug_mutex(r,...) 84 #define ndk_conf_log_debug_event(r,...) 85 #define ndk_conf_log_debug_http(r,...) 86 #define ndk_conf_log_debug_mail(r,...) 87 #define ndk_conf_log_debug_mysql(r,...) 88 89 #define ndk_request_log_debug_core(r,...) 90 #define ndk_request_log_debug_alloc(r,...) 91 #define ndk_request_log_debug_mutex(r,...) 92 #define ndk_request_log_debug_event(r,...) 93 #define ndk_request_log_debug_http(r,...) 94 #define ndk_request_log_debug_mail(r,...) 95 #define ndk_request_log_debug_mysql(r,...) 96 97 #endif 98 99 100 /*********************************/ 101 102 #elif (NGX_HAVE_GCC_VARIADIC_MACROS) 103 104 #define ndk_log_stderr(log,args...) ngx_log_error (NGX_LOG_STDERR, log, 0, args) 105 #define ndk_log_emerg(log,args...) ngx_log_error (NGX_LOG_EMERG, log, 0, args) 106 #define ndk_log_alert(log,args...) ngx_log_error (NGX_LOG_ALERT, log, 0, args) 107 #define ndk_log_crit(log,args...) ngx_log_error (NGX_LOG_CRIT, log, 0, args) 108 #define ndk_log_err(log,args...) ngx_log_error (NGX_LOG_ERR, log, 0, args) 109 #define ndk_log_warning(log,args...) ngx_log_error (NGX_LOG_WARN, log, 0, args) 110 #define ndk_log_notice(log,args...) ngx_log_error (NGX_LOG_NOTICE, log, 0, args) 111 #define ndk_log_info(log,args...) ngx_log_error (NGX_LOG_INFO, log, 0, args) 112 113 #define ndk_log_debug_core(log,args...) ngx_log_debug (NGX_LOG_DEBUG_CORE, log, 0, args) 114 #define ndk_log_debug_alloc(log,args...) ngx_log_debug (NGX_LOG_DEBUG_ALLOC, log, 0, args) 115 #define ndk_log_debug_mutex(log,args...) ngx_log_debug (NGX_LOG_DEBUG_MUTEX, log, 0, args) 116 #define ndk_log_debug_event(log,args...) ngx_log_debug (NGX_LOG_DEBUG_EVENT, log, 0, args) 117 #define ndk_log_debug_http(log,args...) ngx_log_debug (NGX_LOG_DEBUG_HTTP, log, 0, args) 118 #define ndk_log_debug_mail(log,args...) ngx_log_debug (NGX_LOG_DEBUG_MAIL, log, 0, args) 119 #define ndk_log_debug_mysql(log,args...) ngx_log_debug (NGX_LOG_DEBUG_MYSQL, log, 0, args) 120 #define ndk_log_debug_script(log,args...) ngx_log_debug (NGX_LOG_DEBUG_SCRIPT, log, 0, args) 121 122 #define ndk_conf_log_stderr(cf,args...) ngx_conf_log_error (NGX_LOG_STDERR, cf, 0, args) 123 #define ndk_conf_log_emerg(cf,args...) ngx_conf_log_error (NGX_LOG_EMERG, cf, 0, args) 124 #define ndk_conf_log_alert(cf,args...) ngx_conf_log_error (NGX_LOG_ALERT, cf, 0, args) 125 #define ndk_conf_log_crit(cf,args...) ngx_conf_log_error (NGX_LOG_CRIT, cf, 0, args) 126 #define ndk_conf_log_err(cf,args...) ngx_conf_log_error (NGX_LOG_ERR, cf, 0, args) 127 #define ndk_conf_log_warning(cf,args...) ngx_conf_log_error (NGX_LOG_WARN, cf, 0, args) 128 #define ndk_conf_log_notice(cf,args...) ngx_conf_log_error (NGX_LOG_NOTICE, cf, 0, args) 129 #define ndk_conf_log_info(cf,args...) ngx_conf_log_error (NGX_LOG_INFO, cf, 0, args) 130 131 #define ndk_conf_log_debug_core(r,args...) ndk_log_debug_core (ndk_conf_to_log(r), args) 132 #define ndk_conf_log_debug_alloc(r,args...) ndk_log_debug_alloc (ndk_conf_to_log(r), args) 133 #define ndk_conf_log_debug_mutex(r,args...) ndk_log_debug_mutex (ndk_conf_to_log(r), args) 134 #define ndk_conf_log_debug_event(r,args...) ndk_log_debug_event (ndk_conf_to_log(r), args) 135 #define ndk_conf_log_debug_http(r,args...) ndk_log_debug_http (ndk_conf_to_log(r), args) 136 #define ndk_conf_log_debug_mail(r,args...) ndk_log_debug_mail (ndk_conf_to_log(r), args) 137 #define ndk_conf_log_debug_mysql(r,args...) ndk_log_debug_mysql (ndk_conf_to_log(r), args) 138 #define ndk_conf_log_debug_script(r,args...) ndk_log_debug_script (ndk_conf_to_log(r), args) 139 140 #define ndk_request_log_stderr(r,args...) ndk_log_stderr (ndk_request_to_log(r), args) 141 #define ndk_request_log_emerg(r,args...) ndk_log_emerg (ndk_request_to_log(r), args) 142 #define ndk_request_log_alert(r,args...) ndk_log_alert (ndk_request_to_log(r), args) 143 #define ndk_request_log_crit(r,args...) ndk_log_crit (ndk_request_to_log(r), args) 144 #define ndk_request_log_err(r,args...) ndk_log_err (ndk_request_to_log(r), args) 145 #define ndk_request_log_warning(r,args...) ndk_log_warning (ndk_request_to_log(r), args) 146 #define ndk_request_log_notice(r,args...) ndk_log_notice (ndk_request_to_log(r), args) 147 #define ndk_request_log_info(r,args...) ndk_log_info (ndk_request_to_log(r), args) 148 149 #define ndk_request_log_debug_core(r,args...) ndk_log_debug_core (ndk_request_to_log(r), args) 150 #define ndk_request_log_debug_alloc(r,args...) ndk_log_debug_alloc (ndk_request_to_log(r), args) 151 #define ndk_request_log_debug_mutex(r,args...) ndk_log_debug_mutex (ndk_request_to_log(r), args) 152 #define ndk_request_log_debug_event(r,args...) ndk_log_debug_event (ndk_request_to_log(r), args) 153 #define ndk_request_log_debug_http(r,args...) ndk_log_debug_http (ndk_request_to_log(r), args) 154 #define ndk_request_log_debug_mail(r,args...) ndk_log_debug_mail (ndk_request_to_log(r), args) 155 #define ndk_request_log_debug_mysql(r,args...) ndk_log_debug_mysql (ndk_request_to_log(r), args) 156 #define ndk_request_log_debug_script(r,args...) ndk_log_debug_script (ndk_request_to_log(r), args) 157 158 /*********************************/ 159 160 #else /* NO VARIADIC MACROS */ 161 162 /* #warning does not work on Windows */ 163 #pragma message("Nginx Devel Kit logging without variadic macros not yet implemented") 164 165 #endif /* VARIADIC MACROS */ 166