From 4f2a69e9e1612e3fea4ae10eeda82733bfdc95b8 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 29 Mar 2013 08:26:04 -0400 Subject: [PATCH] Added IP to log result. --- framework/logging/Target.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/logging/Target.php b/framework/logging/Target.php index b88e78d..e76e8ac 100644 --- a/framework/logging/Target.php +++ b/framework/logging/Target.php @@ -238,6 +238,7 @@ abstract class Target extends \yii\base\Component if (!is_string($text)) { $text = var_export($text, true); } - return date('Y/m/d H:i:s', $timestamp) . " [$level] [$category] $text\n"; + $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; + return date('Y/m/d H:i:s', $timestamp) . " [$ip] [$level] [$category] $text\n"; } }