Skip to content

Commit

Permalink
Patching Kohana_Log to maintain backwards compatability with 3.0.x se…
Browse files Browse the repository at this point in the history
…ries
  • Loading branch information
BRMatt committed Sep 5, 2010
1 parent 09b8bb1 commit b36d69c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions classes/kohana/date.php
Expand Up @@ -542,12 +542,13 @@ public static function dos2unix($timestamp = FALSE)
* @param string timestamp_format timestamp format
* @return string
*/
public static function formatted_time($datetime_str = 'now', $timestamp_format = NULL)
public static function formatted_time($datetime_str = 'now', $timestamp_format = NULL, $timezone = NULL)
{
$timestamp_format = $timestamp_format == NULL ? Date::$timestamp_format : $timestamp_format;

$timezone = $timezone === NULL ? Date::$timezone : $timezone;

$time = new DateTime($datetime_str, new DateTimeZone(
Date::$timezone ? Date::$timezone : date_default_timezone_get()
$timezone ? $timezone : date_default_timezone_get()
));

return $time->format($timestamp_format);
Expand Down
8 changes: 7 additions & 1 deletion classes/kohana/log.php
Expand Up @@ -18,6 +18,12 @@ class Kohana_Log {
*/
public static $timestamp = 'Y-m-d H:i:s';

/**
* Timezone for log entries
* @var string
*/
public static $timezone;

/**
* Singleton instance container
* @var Kohana_Log
Expand Down Expand Up @@ -112,7 +118,7 @@ public function add($type, $message, array $values = NULL)
// Create a new message and timestamp it
$this->_messages[] = array
(
'time' => Date::formatted_time('now', self::$timestamp),
'time' => Date::formatted_time('now', self::$timestamp, self::$timezone),
'type' => $type,
'body' => $message,
);
Expand Down

0 comments on commit b36d69c

Please sign in to comment.