/** * Shorthand for sending output to stdout and appending to log buffer at the same time. * * @param string $output * @param string $eol */ public function say($output = '', $eol = PHP_EOL) { if (is_array($output)) { $output = join(',', $output); } $this->logOutput .= $output . $eol; switch ($output) { case 'SUCCESS': $output = $this->color->green($output); $output = $this->color->bold($output); break; case 'NOT FOUND': case 'INVALID URL': $output = $this->color->red($output); $output = $this->color->bold($output); break; default: break; } echo $output . $eol; }
public function format(array $record) { $record['padded_level'] = str_pad($record['level_name'], 8); $record['message'] = str_replace("\n", "\n ", $record['message']); $output = parent::format($record); if (dbsteward::$ENABLE_COLOR) { $c = new Color($output); switch ($record['level']) { case Logger::DEBUG: $c->dark_gray(); break; case Logger::WARNING: $c->yellow(); break; case Logger::ERROR: $c->red(); break; } return $c . PHP_EOL; } else { return $output . PHP_EOL; } }