|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00002 // 00003 // +----------------------------------------------------------------------+ 00004 // |zen-cart Open Source E-commerce | 00005 // +----------------------------------------------------------------------+ 00006 // | Copyright (c) 2003 The zen-cart developers | 00007 // | | 00008 // | http://www.zen-cart.com/index.php | 00009 // | | 00010 // | Portions Copyright (c) 2003 osCommerce | 00011 // +----------------------------------------------------------------------+ 00012 // | This source file is subject to version 2.0 of the GPL license, | 00013 // | that is bundled with this package in the file LICENSE, and is | 00014 // | available through the world-wide-web at the following url: | 00015 // | http://www.zen-cart.com/license/2_0.txt. | 00016 // | If you did not receive a copy of the zen-cart license and are unable | 00017 // | to obtain it through the world-wide-web, please send a note to | 00018 // | [email protected] so we can mail you a copy immediately. | 00019 // +----------------------------------------------------------------------+ 00020 00021 // $Id: logger.php 1969 2005-09-13 06:57:21Z drbyte $ 00022 // 00023 00024 class logger { 00025 var $timer_start, $timer_stop, $timer_total; 00026 00027 // class constructor 00028 function logger() { 00029 $this->timer_start(); 00030 } 00031 00032 function timer_start() { 00033 if (defined("PAGE_PARSE_START_TIME")) { 00034 $this->timer_start = PAGE_PARSE_START_TIME; 00035 } else { 00036 $this->timer_start = microtime(); 00037 } 00038 } 00039 00040 function timer_stop($display = 'false') { 00041 $this->timer_stop = microtime(); 00042 00043 $time_start = explode(' ', $this->timer_start); 00044 $time_end = explode(' ', $this->timer_stop); 00045 00046 $this->timer_total = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3); 00047 00048 $this->write($_SERVER['REQUEST_URI'], $this->timer_total . 's'); 00049 00050 if ($display == 'true') { 00051 return $this->timer_display(); 00052 } 00053 } 00054 00055 function timer_display() { 00056 return '<span class="smallText">Parse Time: ' . $this->timer_total . 's</span>'; 00057 } 00058 00059 function write($message, $type) { 00060 error_log(strftime(STORE_PARSE_DATE_TIME_FORMAT) . ' [' . $type . '] ' . $message . "\n", 3, STORE_PAGE_PARSE_TIME_LOG); 00061 } 00062 } 00063 ?>