public function allowLogItem(LogItem $item) { $name = $item->getName(); $allowed = false; if (in_array($name, $this->names)) { $allowed = true; } if ($this->willInvert()) { $allowed = !$allowed; } return $allowed; }
/** * Get the output string of a log item * @param LogItem */ protected function getLogItemOutput(LogItem $item) { $output = ''; $output = date($this->getDateFormat(), $item->getDate()); $output .= self::FIELD_SEPARATOR . substr($item->getMicroTime(), 0, 5); $output .= self::FIELD_SEPARATOR . $item->getIP(); $output .= self::FIELD_SEPARATOR . str_pad($item->getName(), 9); $output .= self::FIELD_SEPARATOR . str_pad(Formatter::formatSize(memory_get_usage()), 9, ' ', STR_PAD_LEFT); $output .= self::FIELD_SEPARATOR . $item->getType(); $output .= self::FIELD_SEPARATOR . $item->getTitle(); $message = $item->getMessage(); if (!empty($message)) { $output .= self::FIELD_SEPARATOR . $message; } $output .= "\n"; return $output; }