public function __construct(array $config = []) { if (empty($config['model'])) { $config['model'] = 'Burzum/DatabaseLog.Logs'; } parent::__construct($config); $this->Model = TableRegistry::get($this->config('model')); }
/** * Constructor. * * @param array $config * @return void */ public function __construct(array $config = []) { parent::__construct($config); $client = new Bugsnag_Client(Configure::read('Bugsnag.apiKey')); foreach ($this->config() as $key => $value) { $method = 'set' . ucfirst($key); if (method_exists($client, $method)) { $client->{$method}($value); } } $client->setBeforeNotifyFunction(function (Bugsnag_Error $error) { $event = new Event('Log.Bugsnag.beforeNotify', $this, ['error' => $error]); EventManager::instance()->dispatch($event); }); $this->setClient($client); }
/** * Constructs a new Console Logger. * * Config * * - `levels` 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 \InvalidArgumentException */ public function __construct(array $config = array()) { if (DS === '\\' && !(bool) env('ANSICON') || function_exists('posix_isatty') && !posix_isatty($this->_output)) { $this->_defaultConfig['outputAs'] = ConsoleOutput::PLAIN; } else { $this->_defaultConfig['outputAs'] = ConsoleOutput::COLOR; } parent::__construct($config); $config = $this->_config; if ($config['stream'] instanceof ConsoleOutput) { $this->_output = $config['stream']; } elseif (is_string($config['stream'])) { $this->_output = new ConsoleOutput($config['stream']); } else { throw new InvalidArgumentException('`stream` not a ConsoleOutput nor string'); } $this->_output->outputAs($config['outputAs']); }
/** * Sets protected properties based on config provided * * @param array $config Configuration array */ public function __construct(array $config = []) { parent::__construct($config); if (!empty($this->_config['path'])) { $this->_path = $this->_config['path']; } if ($this->_path !== null && Configure::read('debug') && !is_dir($this->_path)) { mkdir($this->_path, 0775, true); } if (!empty($this->_config['file'])) { $this->_file = $this->_config['file']; if (substr($this->_file, -4) !== '.log') { $this->_file .= '.log'; } } if (!empty($this->_config['size'])) { if (is_numeric($this->_config['size'])) { $this->_size = (int) $this->_config['size']; } else { $this->_size = Text::parseFileSize($this->_config['size']); } } }
public function __construct(array $config = []) { parent::__construct($config); }
/** * Construct the model class * * @param array $config */ public function __construct($config = []) { parent::__construct($config); $model = !empty($config['model']) ? $config['model'] : 'DatabaseLog.DatabaseLogs'; $this->Logs = TableRegistry::get($model); }