+ if (body) {
+ PHPWRITE(body, strlen(body));
+ }
+ {
+ time_t now;
+ struct tm nowtm;
+
+ time(&now);
+ strftime(datetime, sizeof(datetime), "%Y-%m-%d %H:%M:%S", php_localtime_r(&now, &nowtm));
+ }
+
+#define HTTP_LOG_WRITE(for, type, header) \
+ HTTP_LOG_WRITE_EX(for, type, header); \
+ HTTP_LOG_WRITE_EX(composite, type, header);
+
+#define HTTP_LOG_WRITE_EX(for, type, header) \
+ if (HTTP_G(log).##for && strlen(HTTP_G(log).##for)) { \
+ php_stream *log = php_stream_open_wrapper(HTTP_G(log).##for, "ab", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); \
+ \
+ if (log) { \
+ php_stream_printf(log TSRMLS_CC, "%s [%12s] %32s <%s>%s", datetime, type, header, SG(request_info).request_uri, PHP_EOL); \
+ php_stream_close(log); \
+ } \
+ \