fname = $filename; $this->tag = $tag; // assume debug environment if cachejs is false $this->enabled = (isset($CFG->cachejs) && $CFG->cachejs == false); } public function dump($object) { global $CFG; $this->writeblock(print_r($object,true)); } public function write($str) { $this->writeblock($str); } private function writeblock($str){ if($this->enabled){ $now = new DateTime(); $tagline = "[ {$this->tag} - ".$now->format("c")." ]"; $fp = fopen($this->fname,"a"); fwrite($fp,$tagline . ":\n".$str."\n"); fclose($fp); } } }