diff options
author | Gabriel Potkány <gadelat@gmail.com> | 2014-12-19 12:35:00 +0100 |
---|---|---|
committer | Gabriel Potkány <gadelat@gmail.com> | 2014-12-19 12:35:00 +0100 |
commit | f83262eceefb37053a8a025fefff0cbb03985f2f (patch) | |
tree | 1313b019f3ad2c8df4c8a5b5034bbe9a08d88c6c | |
parent | 1fb0cc743eb087adf0c17ebec2912696c09bbc26 (diff) |
Support for microseconds
-rw-r--r-- | system/core/Log.php | 7 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/system/core/Log.php b/system/core/Log.php index b0576c58f..ab8ae2857 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -198,7 +198,12 @@ class CI_Log { return FALSE; } - $message .= $level.' - '.date($this->_date_fmt).' --> '.$msg."\n"; + // Instantiate DateTime with microseconds accuracy to allow proper use of "u" character in date format + $t = microtime(true); + $micro = sprintf("%06d",($t - floor($t)) * 1000000); + $date = new DateTime(date('Y-m-d H:i:s.'.$micro, $t)); + + $message .= $level.' - '.$date->format($this->_date_fmt).' --> '.$msg."\n"; flock($fp, LOCK_EX); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 05442d803..5b2813b83 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -553,6 +553,7 @@ Release Date: Not Released - Added a ``$config['log_file_permissions']`` setting. - Changed the library constructor to try to create the **log_path** directory if it doesn't exist. + - Added support for microseconds ("u" date format character) in ``$config['log_date_format']`` - Added `compatibility layers <general/compatibility_functions>` for: |