Esempio n. 1
0
 public function __construct($config = array())
 {
     $config = Hash::merge($this->_defaults, $config);
     if (is_null($this->logger)) {
         $this->logger = FluentLogger::open($config['host'], $config['port']);
     }
     parent::__construct($config);
 }
Esempio n. 2
0
 /**
  * Constructs a new Sentry Logger.
  *
  * Config
  *
  * - `server` string, url of the Sentry server [default: Configure::read('Sentry.PHP.server')]
  * - `clientOptions` array, Options to pass to the CakeRavenClient constructor
  *
  * @param array $options Options for the SentryLog, see above.
  */
 public function __construct($config = array())
 {
     $config = Hash::merge(array('server' => Configure::read('Sentry.PHP.server'), 'clientOptions' => array('auto_log_stacks' => true)), $config);
     parent::__construct($config);
     if (Configure::read('debug') == 0 || !Configure::read('Sentry.production_only')) {
         Raven_Autoloader::register();
         $this->__client = new CakeRavenClient($this->_config['server'], $this->_config['clientOptions']);
     }
 }
Esempio n. 3
0
 /**
  * Constructs a new File Logger.
  *
  * Config
  *
  * - `types` string or array, levels the engine is interested in
  * - `scopes` string or array, scopes the engine is interested in
  * - `file` log file name
  * - `path` the path to save logs on.
  *
  * @param array $options Options for the FileLog, see above.
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     $config = Hash::merge(array('path' => LOGS, 'file' => null, 'types' => null, 'scopes' => array()), $this->_config);
     $config = $this->config($config);
     $this->_path = $config['path'];
     $this->_file = $config['file'];
     if (!empty($this->_file) && !preg_match('/\\.log$/', $this->_file)) {
         $this->_file .= '.log';
     }
 }
Esempio n. 4
0
 public function __construct($config = array())
 {
     parent::__construct(array_merge($this->defaults, $config));
     extract($this->_config);
     if (!class_exists('Monolog\\Logger')) {
         $this->includeMonolog();
     }
     $this->log = new Logger($channel);
     $this->__push($this->log, $handlers);
     $this->__push($this->log, $processors, 'Processor');
 }
Esempio n. 5
0
 /**
  * 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']);
 }
Esempio n. 6
0
/**
 * Constructs a new File Logger.
 *
 * Config
 *
 * - `types` string or array, levels the engine is interested in
 * - `scopes` string or array, scopes the engine is interested in
 * - `file` log file name
 * - `path` the path to save logs on.
 *
 * @param array $options Options for the FileLog, see above.
 */
	public function __construct($config = array()) {
		parent::__construct($config);
		$config = Hash::merge(array(
			'path' => LOGS,
			'file' => null,
			'types' => null,
			'scopes' => array(),
			), $this->_config);
		$config = $this->config($config);
		$this->_path = $config['path'];
		$this->_file = $config['file'];
		if (!empty($this->_file) && substr($this->_file, -4) !== '.log') {
			$this->_file .= '.log';
		}
	}
Esempio n. 7
0
 /**
  * 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']);
 }
Esempio n. 8
0
 /**
  * Constructs a new File Logger.
  *
  * Config
  *
  * - `types` string or array, levels the engine is interested in
  * - `scopes` string or array, scopes the engine is interested in
  * - `file` Log file name
  * - `path` The path to save logs on.
  * - `size` Used to implement basic log file rotation. If log file size
  *   reaches specified size the existing file is renamed by appending timestamp
  *   to filename and new log file is created. Can be integer bytes value or
  *   human reabable string values like '10MB', '100KB' etc.
  * - `rotate` Log files are rotated specified times before being removed.
  *   If value is 0, old versions are removed rather then rotated.
  * - `mask` A mask is applied when log files are created. Left empty no chmod
  *   is made.
  *
  * @param array $config Options for the FileLog, see above.
  */
 public function __construct($config = array())
 {
     $config = Hash::merge($this->_defaults, $config);
     parent::__construct($config);
 }
Esempio n. 9
0
 /**
  * Make sure the configuration contains the format parameter, by default it uses
  * the error number and the type as a prefix to the message
  *
  * @param array $config
  */
 public function __construct($config = array())
 {
     $config += $this->_defaults;
     parent::__construct($config);
 }