public static function parse($line, $output, $settings)
	{
		$bits     = explode(' ', $line, count(static::$fields));
		$index    = 0;
		$i_used   = 0;
		$style    = null;
		$exceeded = false;

		// First loop through and see if any of our thresholds are exceeded
		if (is_array($settings['threshold']))
		{
			foreach (static::$fields as $field => $show)
			{
				if (isset($settings['threshold'][$field]))
				{
					$operator = $settings['threshold'][$field]['operator'];
					$value    = $settings['threshold'][$field]['value'];
					switch ($operator)
					{
						case '=':
							$statement = (trim($bits[$index]) == $value);
							break;

						case '<':
							$statement = (trim($bits[$index]) < $value);
							break;

						case '>':
						default:
							$statement = (trim($bits[$index]) > $value);
							break;
					}

					if ($statement)
					{
						$exceeded[] = $field;
					}
				}

				$index++;
			}
		}

		// Reset index
		$index = 0;

		// Loop through and do actual output
		foreach (static::$fields as $field => $show)
		{
			if ($show)
			{
				if ($exceeded)
				{
					$style = array('color'=>'red');

					if (in_array($field, $exceeded))
					{
						$style = 'error';
					}
				}

				if ($i_used != 0)
				{
					$output->addString(' ');
				}

				$value = trim($bits[$index]);

				// See if we need to change date format
				if (isset(static::$dateFormat))
				{
					$d = \DateTime::createFromFormat(static::$dateFormat, $value);
					if ($d && $d->format(static::$dateFormat) == $value)
					{
						$value = $d->format($settings['dateFormat']);
					}
				}

				if (method_exists(get_called_class(), 'parse' . ucfirst($field)))
				{
					$method = 'parse' . ucfirst($field);
					$value  = static::$method($value);
				}

				$output->addString($value, $style);

				// Increment used count
				$i_used++;
			}

			// Increment total count
			$index++;
		}

		$output->addSpacer();

		// See if the total time exceeds the given threshold
		if ($exceeded && !$settings['noBeep'])
		{
			$output->beep();
		}
	}
public static function parse($line, $output, $settings)
	{
		$bits     = explode(' ', $line, count(static::$fields));
		$index    = 0;
		$i_used   = 0;
		$style    = null;
		$exceeded = false;

		// First loop through and see if any of our thresholds are exceeded
		if (is_array($settings['threshold']))
		{
			foreach (static::$fields as $field => $show)
			{
				if (isset($settings['threshold'][$field]))
				{
					$operator = $settings['threshold'][$field]['operator'];
					$value    = $settings['threshold'][$field]['value'];
					switch ($operator)
					{
						case '=':
							$statement = (trim($bits[$index]) == $value);
							break;

						case '<':
							$statement = (trim($bits[$index]) < $value);
							break;

						case '>':
						default:
							$statement = (trim($bits[$index]) > $value);
							break;
					}

					if ($statement)
					{
						$exceeded[] = $field;
					}
				}

				$index++;
			}
		}

		// Reset index
		$index = 0;

		// Loop through and do actual output
		foreach (static::$fields as $field => $show)
		{
			if ($show)
			{
				if ($exceeded)
				{
					$style = array('color'=>'red');

					if (in_array($field, $exceeded))
					{
						$style = 'error';
					}
				}

				if ($i_used != 0)
				{
					$output->addString(' ');
				}

				$value = trim($bits[$index]);

				// See if we need to change date format
				if (isset(static::$dateFormat))
				{
					$d = \DateTime::createFromFormat(static::$dateFormat, $value);
					if ($d && $d->format(static::$dateFormat) == $value)
					{
						$value = $d->format($settings['dateFormat']);
					}
				}

				if (method_exists(get_called_class(), 'parse' . ucfirst($field)))
				{
					$method = 'parse' . ucfirst($field);
					$value  = static::$method($value);
				}

				$output->addString($value, $style);

				// Increment used count
				$i_used++;
			}

			// Increment total count
			$index++;
		}

		$output->addSpacer();

		// See if the total time exceeds the given threshold
		if ($exceeded && !$settings['noBeep'])
		{
			$output->beep();
		}
	}
public static function parse ( $ line , $ output , $ settings ) { $ bits = explode ( ' ' , $ line , count ( static :: $ fields ) ) ; $ index = 0 ; $ i_used = 0 ; $ style = null ; $ exceeded = false ; // First loop through and see if any of our thresholds are exceeded if ( is_array ( $ settings [ 'threshold' ] ) ) { foreach ( static :: $ fields as $ field => $ show ) { if ( isset ( $ settings [ 'threshold' ] [ $ field ] ) ) { $ operator = $ settings [ 'threshold' ] [ $ field ] [ 'operator' ] ; $ value = $ settings [ 'threshold' ] [ $ field ] [ 'value' ] ; switch ( $ operator ) { case '=' : $ statement = ( trim ( $ bits [ $ index ] ) == $ value ) ; break ; case '<' : $ statement = ( trim ( $ bits [ $ index ] ) < $ value ) ; break ; case '>' : default : $ statement = ( trim ( $ bits [ $ index ] ) > $ value ) ; break ; } if ( $ statement ) { $ exceeded [ ] = $ field ; } } $ index ++ ; } } // Reset index $ index = 0 ; // Loop through and do actual output foreach ( static :: $ fields as $ field => $ show ) { if ( $ show ) { if ( $ exceeded ) { $ style = array ( 'color' => 'red' ) ; if ( in_array ( $ field , $ exceeded ) ) { $ style = 'error' ; } } if ( $ i_used != 0 ) { $ output -> addString ( ' ' ) ; } $ value = trim ( $ bits [ $ index ] ) ; // See if we need to change date format if ( isset ( static :: $ dateFormat ) ) { $ d = \ DateTime :: createFromFormat ( static :: $ dateFormat , $ value ) ; if ( $ d && $ d -> format ( static :: $ dateFormat ) == $ value ) { $ value = $ d -> format ( $ settings [ 'dateFormat' ] ) ; } } if ( method_exists ( get_called_class ( ) , 'parse' . ucfirst ( $ field ) ) ) { $ method = 'parse' . ucfirst ( $ field ) ; $ value = static :: $ method ( $ value ) ; } $ output -> addString ( $ value , $ style ) ; // Increment used count $ i_used ++ ; } // Increment total count $ index ++ ; } $ output -> addSpacer ( ) ; // See if the total time exceeds the given threshold if ( $ exceeded && ! $ settings [ 'noBeep' ] ) { $ output -> beep ( ) ; } }
Parse log line

@param   string  $line      Log line
@param   object  $output    Output object
@param   array   $settings  Settings to honor
@return  void
Parse log line