Example #1
0
 public function init()
 {
     if (is_string($this->slack)) {
         $this->slack = Yii::$app->get($this->slack);
     } elseif (is_array($this->slack)) {
         if (!isset($this->slack['class'])) {
             $this->slack['class'] = Client::className();
         }
         $this->slack = Yii::createObject($this->slack);
     }
     if (!$this->slack instanceof Client) {
         throw new InvalidConfigException("LogTarget::slack must be either a Slack client instance or the application component ID of a Slack client.");
     }
 }
Example #2
0
 /**
  * Exports log [[messages]] to a specific destination.
  * Child classes must implement this method.
  */
 public function export()
 {
     $this->slack->send(null, $this->emoji, $this->getAttachments());
 }
Example #3
0
 /**
  * Exports log [[messages]] to a specific destination.
  * Child classes must implement this method.
  */
 public function export()
 {
     $this->slack->send("Log message", $this->emoji, $this->getAttachments());
 }