/** * Constructs a new Console Logger. * * Config * * - `types` string or array, levels the engine is interested in * - `scopes` string or array, scopes the engine is interested in * - `stream` the path to save logs on. * - `outputAs` integer or ConsoleOutput::[RAW|PLAIN|COLOR] * * @param array $config * Options for the FileLog, see above. * @throws CakeLogException */ public function __construct($config = array()) { parent::__construct($config); $config = Hash::merge(array('stream' => 'php://stderr', 'types' => null, 'scopes' => array(), 'outputAs' => ConsoleOutput::COLOR), $this->_config); $config = $this->config($config); if ($config['stream'] instanceof ConsoleOutput) { $this->_output = $config['stream']; } elseif (is_string($config['stream'])) { $this->_output = new ConsoleOutput($config['stream']); } else { throw new CakeLogException('`stream` not a ConsoleOutput nor string'); } $this->_output->outputAs($config['outputAs']); }
/** * Constructs a new Console Logger. * * Config * * - `types` string or array, levels the engine is interested in * - `scopes` string or array, scopes the engine is interested in * - `stream` the path to save logs on. * - `outputAs` integer or ConsoleOutput::[RAW|PLAIN|COLOR] * * @param array $config Options for the FileLog, see above. * @throws CakeLogException */ public function __construct($config = array()) { parent::__construct($config); if (DS === '\\' && !(bool) env('ANSICON') && env('ConEmuANSI') !== 'ON' || function_exists('posix_isatty') && !posix_isatty($this->_output)) { $outputAs = ConsoleOutput::PLAIN; } else { $outputAs = ConsoleOutput::COLOR; } $config = Hash::merge(array('stream' => 'php://stderr', 'types' => null, 'scopes' => array(), 'outputAs' => $outputAs), $this->_config); $config = $this->config($config); if ($config['stream'] instanceof ConsoleOutput) { $this->_output = $config['stream']; } elseif (is_string($config['stream'])) { $this->_output = new ConsoleOutput($config['stream']); } else { throw new CakeLogException('`stream` not a ConsoleOutput nor string'); } $this->_output->outputAs($config['outputAs']); }
/** * Display the help in the correct format * * @param string $command The command to get help for. * @return void */ protected function _displayHelp($command) { $format = 'text'; if (!empty($this->args[0]) && $this->args[0] === 'xml') { $format = 'xml'; $this->stdout->outputAs(ConsoleOutput::RAW); } else { $this->_welcome(); } return $this->out($this->OptionParser->help($command, $format)); }