. /** * @author Dick Munroe * @copyright copyright @ by Dick Munroe, 2004 * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @package StructuredDataDumper */ /* * Edit History: * * Dick Munroe munroe@cworks.com 23-Dec-2004 * Initial version created/ */ defined('MOODLE_INTERNAL') || die(); require_once('SDD/class.SDD.php'); class logfile extends SDD { /* * The open file handle. * * @access private */ protected $m_handle; /* * Constructor * * @access public */ public function init($thefilename) { if (file_exists($thefilename)) { $this->m_handle = fopen($thefilename, 'a'); } else { $this->m_handle = fopen($thefilename, 'w'); } } public function close() { fclose($this->m_handle); } /* * Write a debugging value to a log file. * * @access public * @abstract * @param mixed Data to be logged. * @return integer number of bytes written to the log. */ public function log(&$thedata) { return fwrite($this->m_handle, date('[Y-m-d H:i:s]: ') . $this->dump($thedata) . "\n"); } }