예제 #1
0
 /**
  * Send the log data to registered outputs
  *
  * @param $logLevel
  * @param $message
  * @param array $context
  * @throws \InvalidArgumentException
  * @return bool
  */
 protected function output($logLevel, $message, array $context = [])
 {
     if ($logLevel < $this->config->getLogLevel()) {
         return false;
     }
     $this->logData = ['app_id' => $this->config->getAppId(), 'channel' => $this->config->getChannel(), 'environment' => $this->config->getEnvironment(), 'message' => (string) $message, 'context' => empty($context) ? null : json_encode($context), 'log_level' => $logLevel, 'log_level_name' => $this->getLogLevelName($logLevel), 'extras' => $this->config->getExtraValues(), 'trace' => $this->backtrace->info(), 'created_at' => $this->config->getDateTimeFormatted()];
     foreach ($this->config->getOutputHandlers() as $v) {
         $v->send(json_encode($this->logData));
     }
     return true;
 }
예제 #2
0
 public function testSetAppId()
 {
     $this->assertEquals('b85066fc-248f-4ea9-b13d-0858dbf4efc1', $this->config->getAppId());
     $this->config->setAppId('a85066fc-248f-4ea9-b13d-0858dbf4efc1');
     $this->assertEquals('a85066fc-248f-4ea9-b13d-0858dbf4efc1', $this->config->getAppId());
 }