summaryrefslogtreecommitdiffstats
path: root/system/core/Log.php
diff options
context:
space:
mode:
authorAhmad Anbar <aanbar@gmail.com>2015-02-04 18:20:01 +0100
committerAhmad Anbar <aanbar@gmail.com>2015-02-04 18:20:01 +0100
commite5454f9b28f123a5549971f580255a065b2f8cc2 (patch)
treec4927e7b7afb0bf242976034630cc60f2f1db00f /system/core/Log.php
parent6db62ab0ad0e223806a1367e12b1884b48dc65d7 (diff)
parenteccac6e6a73a4d1a5b40f383ce64359c2c94ae12 (diff)
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'system/core/Log.php')
-rw-r--r--system/core/Log.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/system/core/Log.php b/system/core/Log.php
index 7d318ed57..833316273 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -198,7 +198,20 @@ class CI_Log {
return FALSE;
}
- $message .= $level.' - '.date($this->_date_fmt).' --> '.$msg."\n";
+ // Instantiating DateTime with microseconds appended to initial date is needed for proper support of this format
+ if (strpos($this->_date_fmt, 'u') !== FALSE)
+ {
+ $microtime_full = microtime(TRUE);
+ $microtime_short = sprintf("%06d", ($microtime_full - floor($microtime_full)) * 1000000);
+ $date = new DateTime(date('Y-m-d H:i:s.'.$microtime_short, $microtime_full));
+ $date = $date->format($this->_date_fmt);
+ }
+ else
+ {
+ $date = date($this->_date_fmt);
+ }
+
+ $message .= $level.' - '.$date.' --> '.$msg."\n";
flock($fp, LOCK_EX);
@@ -222,6 +235,3 @@ class CI_Log {
}
}
-
-/* End of file Log.php */
-/* Location: ./system/core/Log.php */ \ No newline at end of file