diff options
author | Martin Jansen <martin@divbyzero.net> | 2012-12-24 11:11:28 +0100 |
---|---|---|
committer | Lars Strojny <lstrojny@php.net> | 2013-01-06 15:04:19 +0100 |
commit | 4a3bf25e3ffa71d8d65df686c27903d7c9fafee6 (patch) | |
tree | 6480fff68080ac3981e38eba6dc39e2133e69472 /ext/standard/mail.c | |
parent | 853ef3c9cba5458e403f627103d12351f88ec52f (diff) | |
download | php-git-4a3bf25e3ffa71d8d65df686c27903d7c9fafee6.tar.gz |
Add a timestamp to the mail log.
This patch is loosely based on the one in bug #52126 but instead of
using a UNIX timestamp it uses the date format also being used by
error_log et al.
Diffstat (limited to 'ext/standard/mail.c')
-rw-r--r-- | ext/standard/mail.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 25766818f6..c8fd55e821 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -21,10 +21,12 @@ #include <stdlib.h> #include <ctype.h> #include <stdio.h> +#include <time.h> #include "php.h" #include "ext/standard/info.h" #include "ext/standard/php_string.h" #include "ext/standard/basic_functions.h" +#include "ext/date/php_date.h" #if HAVE_SYSEXITS_H #include <sysexits.h> @@ -246,8 +248,15 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char return val; \ if (mail_log && *mail_log) { - char *tmp; - int l = spprintf(&tmp, 0, "mail() on [%s:%d]: To: %s -- Headers: %s\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : ""); + char *tmp, *date_str; + time_t curtime; + + time(&curtime); + date_str = php_format_date("d-M-Y H:i:s e", 13, curtime, 1 TSRMLS_CC); + + int l = spprintf(&tmp, 0, "[%s] mail() on [%s:%d]: To: %s -- Headers: %s\n", date_str, zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : ""); + + efree(date_str); if (hdr) { php_mail_log_crlf_to_spaces(tmp); |