runlevel = $runlevel; $this->printout = $printout; } public function log($msg, $runlevel = null) { if($runlevel === null) $runlevel = self::LOG_INFO; $this->data[] = array($this->runlevel, $msg); if($this->printout and $runlevel <= $this->runlevel) echo "{$this->names[$runlevel]}: $msg\n"; } public function printout($clear = true, $runlevel = null) { if($runlevel === null) $runlevel = $this->runlevel; foreach($this->data as $data) { if($runlevel <= $data[0]) echo "{$this->names[$runlevel]}: $data[1]\n"; } if($clear) $this->data = array(); } } ?>