diff --git a/NEWS b/NEWS index 75ef406..64b9472 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ * Version 2.7 unreleased - * Record complete timestamp when request is received - (syslog doesn't record year nor sub-second resolution). + * Timestamp request and response because syslog doesn't record year + nor sub-second resolution. * Version 2.6 released 2010-08-02 diff --git a/ykval-common.php b/ykval-common.php index 76073b9..cf8f5eb 100644 --- a/ykval-common.php +++ b/ykval-common.php @@ -238,14 +238,20 @@ function sendResp($status, $apiKey = '', $extra = null) { } $h = sign($a, $apiKey); - echo "h=" . $h . "\r\n"; - echo "t=" . ($a['t']) . "\r\n"; + $str = "h=" . $h . "\r\n"; + $str .= "t=" . ($a['t']) . "\r\n"; if ($extra){ foreach ($extra as $param => $value) { - echo $param . "=" . $value . "\r\n"; + $str .= $param . "=" . $value . "\r\n"; } } - echo "status=" . ($a['status']) . "\r\n"; - echo "\r\n"; + $str .= "status=" . ($a['status']) . "\r\n"; + $str .= "\r\n"; + + global $ykval_common_log; + $ykval_common_log->log(LOG_INFO, "Response: " . $str . + " (at " . date("c") . " " . microtime() . ")"); + + echo $str; } ?>