log.php (754B)
1 <?php 2 /** 3 * @package OpenCart 4 * @author Daniel Kerr 5 * @copyright Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/) 6 * @license https://opensource.org/licenses/GPL-3.0 7 * @link https://www.opencart.com 8 */ 9 10 /** 11 * Log class 12 */ 13 class Log { 14 private $handle; 15 16 /** 17 * Constructor 18 * 19 * @param string $filename 20 */ 21 public function __construct($filename) { 22 $this->handle = fopen(DIR_LOGS . $filename, 'a'); 23 } 24 25 /** 26 * 27 * 28 * @param string $message 29 */ 30 public function write($message) { 31 fwrite($this->handle, date('Y-m-d G:i:s') . ' - ' . print_r($message, true) . "\n"); 32 } 33 34 /** 35 * 36 * 37 */ 38 public function __destruct() { 39 fclose($this->handle); 40 } 41 }