<?php // Starts session before header is sent session_start(); require_once '../../../init/initLog.inc.php'; $currentDay = DateTool::getTimeString(DateTool::FORMAT_MYSQL_DATE); define('TAIL_LOG_FILE', LOG_DIR . '/' . $currentDay . '-web.log'); $grep = RequestTool::getParameter('grep', RequestTool::PARAM_TYPE_FREE, false); $logFile = file_exists(TAIL_LOG_FILE) ? file(TAIL_LOG_FILE) : array(); $starterLine = SessionTool::getInstance()->getParameter('startLine', false, 0); $lineCount = count($logFile); for ($index = $starterLine; $index < $lineCount; ++$index) { // Filter lines per grep if ($grep && !StringTool::strpos($logFile[$index], $grep)) { continue; } $truncate = true; switch (StringTool::substr($logFile[$index], 0, 7)) { case "[1;32m": $color = '#5F5'; // Green break; case "[1;33m": $color = '#FF5'; // Yellow break; case "[0;31m": $color = '#F55'; // Red break; case "[1;34m":
/** * Checks if a string contains another one * @param string $string The original string * @param string $search The searched string * @return boolean If the $string contains at least one occurence of $search or not */ public static function contains($string, $search) { return StringTool::strpos($string, $search) !== false; }