com php-src: add microseconds to error log: main/main.c
| From: | Antony Dovgal | Date: | Thu, 12 Dec 2013 08:47:43 +0000 |
| Subject: | com php-src: add microseconds to error log: main/main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76636@lists.php.net to get a copy of this message | ||
Commit: f394979d26582da0f37325d1463b8768a6422fe4
Author: Antony Dovgal <tony2001@php.net> Tue, 26 Feb 2013 15:25:57 +0400
Parents: cc71c7b5f51f55ee47ad14f9fe9bf15dd89ac9b6
Branches: badoo-5.5_mysqlnd
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f394979d26582da0f37325d1463b8768a6422fe4
Log:
add microseconds to error log
Conflicts:
main/main.c
Changed paths:
M main/main.c
Diff:
diff --git a/main/main.c b/main/main.c
index 68e2007..7702ace 100644
--- a/main/main.c
+++ b/main/main.c
@@ -611,7 +611,7 @@ PHPAPI int php_get_module_initialized(void)
PHPAPI void php_log_err(char *log_message TSRMLS_DC)
{
int fd = -1;
- time_t error_time;
+ struct timeval error_time;
if (PG(in_error_log)) {
/* prevent recursive invocation */
@@ -648,10 +648,10 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
char error_time_str[128];
static const char *months[12] = { "Jan", "Feb", "Mar",
"Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec" };
- time(&error_time);
- php_localtime_r(&error_time, &tmbuf);
+ gettimeofday(&error_time, NULL);
+ php_localtime_r(&(error_time.tv_sec), &tmbuf);
strftime(error_time_str, sizeof(error_time_str), "%Y %H:%M:%S", &tmbuf);
- len = spprintf(&tmp, 0, "[%02d-%s-%s] %s%s", tmbuf.tm_mday, months[tmbuf.tm_mon],
error_time_str, log_message, PHP_EOL);
+ len = spprintf(&tmp, 0, "[%02d-%s-%s.%06ld] %s%s", tmbuf.tm_mday,
months[tmbuf.tm_mon], error_time_str, error_time.tv_usec, log_message, PHP_EOL);
#ifdef PHP_WIN32
php_flock(fd, 2);
#endif