/** * Write the log to database * * @param mixed $level * @param string $message * @param array $context * @return bool Success */ public function log($level, $message, array $context = []) { if ($this->config('type')) { $level = $this->config('type'); } return $this->Logs->log($level, $message, $context); }
/** * Setup * * @return void */ public function setUp() { parent::setUp(); $this->Logs = TableRegistry::get('DatabaseLog.DatabaseLogs'); if (!$this->Logs->find()->count()) { $this->Logs->log('warning', 'Foo Warning', ['x' => 'y']); } }