function write($string, $verbosityLevel = self::LEVEL_NOTICE, $label = "", $backgroundClass = "", $alwaysLog = false) { $enabled = eZDebug::isDebugEnabled(); if (!$alwaysLog and !$enabled) { return; } switch ($verbosityLevel) { case self::LEVEL_NOTICE: case self::LEVEL_WARNING: case self::LEVEL_ERROR: case self::LEVEL_DEBUG: case self::LEVEL_TIMING_POINT: case self::LEVEL_STRICT: break; default: $verbosityLevel = self::LEVEL_ERROR; break; } if ($this->MessageOutput & self::OUTPUT_MESSAGE_SCREEN and $enabled) { print "{$verbosityLevel}: {$string} ({$label})\n"; } $files = $this->logFiles(); $fileName = false; if (isset($files[$verbosityLevel])) { $fileName = $files[$verbosityLevel]; } if ($this->MessageOutput & self::OUTPUT_MESSAGE_STORE or $alwaysLog) { if (!eZDebug::isLogOnlyEnabled() and $enabled) { $ip = eZSys::clientIP(); if (!$ip) { $ip = eZSys::serverVariable('HOSTNAME', true); } $this->DebugStrings[] = array("Level" => $verbosityLevel, "IP" => $ip, "Time" => time(), "Label" => $label, "String" => $string, "BackgroundClass" => $backgroundClass); } if ($fileName !== false) { $timePoints = $this->TmpTimePoints[$verbosityLevel]; if (is_array($timePoints)) { if ($this->isLogFileEnabled($verbosityLevel)) { foreach ($timePoints as $tp) { $desc = "Timing Point: " . $tp["Description"]; $this->writeFile($fileName, $desc, $verbosityLevel, $alwaysLog); } } $this->TmpTimePoints[$verbosityLevel] = false; } if ($this->isLogFileEnabled($verbosityLevel)) { $string = "{$label}:\n{$string}"; $this->writeFile($fileName, $string, $verbosityLevel, $alwaysLog); } } } }