* 20130702.2 (2.5.0-dev) Add ap_log_data(), ap_log_rdata(), etc.
* 20130702.3 (2.5.0-dev) Add util_fcgi.h, FastCGI protocol support
* 20130903.0 (2.5.0-dev) Changes sizeof(worker_score) in scoreboard
+ * 20130924.0 (2.5.0-dev) Add ap_errorlog_provider
*/
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20130903
+#define MODULE_MAGIC_NUMBER_MAJOR 20130924
#endif
#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
#define AP_ERRORLOG_PROVIDER_VERSION "0"
#define AP_ERRORLOG_DEFAULT_PROVIDER "file"
+/** add APR_EOL_STR to the end of log message */
+#define AP_ERRORLOG_PROVIDER_ADD_EOL_STR 1
+
typedef struct ap_errorlog_provider ap_errorlog_provider;
struct ap_errorlog_provider {
* @param len Length of the error message
*/
apr_status_t (*writer)(const ap_errorlog_info *info, void *handle,
- const char *errstr, int len);
+ const char *errstr, apr_size_t len);
+
+ /** a combination of the AP_ERRORLOG_PROVIDER_* flags */
+ unsigned int flags;
};
/**
}
static apr_status_t syslog_error_log(const ap_errorlog_info *info,
- void *handle, const char *errstr, int len)
+ void *handle, const char *errstr,
+ apr_size_t len)
{
int level = info->level;
{
static const ap_errorlog_provider syslog_provider = {
&syslog_error_log_init,
- &syslog_error_log
+ &syslog_error_log,
+ 0
};
ap_register_provider(p, AP_ERRORLOG_PROVIDER_GROUP, "syslog",
int level)
{
- /* Truncate for the terminator (as apr_snprintf does) */
- if (len > MAX_STRING_LEN - sizeof(APR_EOL_STR)) {
- len = MAX_STRING_LEN - sizeof(APR_EOL_STR);
- }
- strcpy(errstr + len, APR_EOL_STR);
apr_file_puts(errstr, logf);
apr_file_flush(logf);
}
continue;
}
+ if (logf || (s->errorlog_provider->flags &
+ AP_ERRORLOG_PROVIDER_ADD_EOL_STR)) {
+ /* Truncate for the terminator (as apr_snprintf does) */
+ if (len > MAX_STRING_LEN - sizeof(APR_EOL_STR)) {
+ len = MAX_STRING_LEN - sizeof(APR_EOL_STR);
+ }
+ strcpy(errstr + len, APR_EOL_STR);
+ }
+
if (logf) {
write_logline(errstr, len, logf, level_and_mask);
}