| 1139 | } |
| 1140 | |
| 1141 | static void write_logline(char *errstr, apr_size_t len, apr_file_t *logf, |
| 1142 | int level) |
| 1143 | { |
| 1144 | /* NULL if we are logging to syslog */ |
| 1145 | if (logf) { |
| 1146 | /* Truncate for the terminator (as apr_snprintf does) */ |
| 1147 | if (len > MAX_STRING_LEN - sizeof(APR_EOL_STR)) { |
| 1148 | len = MAX_STRING_LEN - sizeof(APR_EOL_STR); |
| 1149 | } |
| 1150 | strcpy(errstr + len, APR_EOL_STR); |
| 1151 | apr_file_puts(errstr, logf); |
| 1152 | apr_file_flush(logf); |
| 1153 | } |
| 1154 | #ifdef HAVE_SYSLOG |
| 1155 | else { |
| 1156 | syslog(level < LOG_PRIMASK ? level : APLOG_DEBUG, "%.*s", |
| 1157 | (int)len, errstr); |
| 1158 | } |
| 1159 | #endif |
| 1160 | } |
| 1161 | |
| 1162 | static void log_error_core(const char *file, int line, int module_index, |
| 1163 | int level, |