| 655 | } |
| 656 | |
| 657 | static int log_ctime(const ap_errorlog_info *info, const char *arg, |
| 658 | char *buf, int buflen) |
| 659 | { |
| 660 | int time_len = buflen; |
| 661 | int option = AP_CTIME_OPTION_NONE; |
| 662 | |
| 663 | if (arg) { |
| 664 | if (arg[0] == 'u' && !arg[1]) { /* no ErrorLogFormat (fast path) */ |
| 665 | option |= AP_CTIME_OPTION_USEC; |
| 666 | } |
| 667 | else if (arg[0] == 'm' && !arg[1]) { /* no ErrorLogFormat (fast path) - msec */ |
| 668 | option |= AP_CTIME_OPTION_MSEC; |
| 669 | } |
| 670 | else if (!ap_strchr_c(arg, '%')) { /* special "%{mcuz}t" formats */ |
| 671 | while (*arg) { |
| 672 | switch (*arg++) { |
| 673 | case 'm': |
| 674 | option |= AP_CTIME_OPTION_MSEC; |
| 675 | break; |
| 676 | case 'u': |
| 677 | option |= AP_CTIME_OPTION_USEC; |
| 678 | break; |
| 679 | case 'c': |
| 680 | option |= AP_CTIME_OPTION_COMPACT; |
| 681 | break; |
| 682 | case 'z': |
| 683 | option |= AP_CTIME_OPTION_GMTOFF; |
| 684 | break; |
| 685 | } |
| 686 | } |
| 687 | } |
| 688 | else { /* "%{strftime %-format}t" */ |
| 689 | apr_size_t len = 0; |
| 690 | apr_time_exp_t expt; |
| 691 | ap_explode_recent_localtime(&expt, apr_time_now()); |
| 692 | apr_strftime(buf, &len, buflen, arg, &expt); |
| 693 | return (int)len; |
| 694 | } |
| 695 | } |
| 696 | |
| 697 | ap_recent_ctime_ex(buf, apr_time_now(), option, &time_len); |
| 698 | |
| 699 | /* ap_recent_ctime_ex includes the trailing \0 in time_len */ |
| 700 | return time_len - 1; |
| 701 | } |
| 702 | |
| 703 | static int log_loglevel(const ap_errorlog_info *info, const char *arg, |
| 704 | char *buf, int buflen) |
no test coverage detected