當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Handler\SocketHandler類代碼示例

本文整理匯總了PHP中Monolog\Handler\SocketHandler的典型用法代碼示例。如果您正苦於以下問題:PHP SocketHandler類的具體用法?PHP SocketHandler怎麽用?PHP SocketHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SocketHandler類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUpNetworkLogs

 /**
  * @param Container $container
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.ElseExpression)
  */
 protected static function setUpNetworkLogs(Container $container)
 {
     $container[LoggerInterface::class] = function (Container $container) {
         $appConfig = $container->get(ConfigInterface::class)->getConfig(C::class);
         $monolog = new Logger($appConfig[C::KEY_NAME]);
         if ($appConfig[C::KEY_IS_LOG_ENABLED] === true) {
             $handler = new SocketHandler('udp://localhost:8081', $appConfig[C::KEY_LOG_LEVEL]);
             $handler->pushProcessor(new WebProcessor());
             $handler->pushProcessor(new UidProcessor());
         } else {
             $handler = new NullHandler();
         }
         $monolog->pushHandler($handler);
         return $monolog;
     };
 }
開發者ID:limoncello-php,項目名稱:app,代碼行數:23,代碼來源:SetUpLogs.php

示例2: __construct

 /**
  * @param string  $token  Pushover api token
  * @param string  $user   Pushover user id the message will be sent to
  * @param string  $title  Title sent to Pushover API
  * @param integer $level  The minimum logging level at which this handler will be triggered
  * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct($token, $user, $title = null, $level = Logger::CRITICAL, $bubble = true)
 {
     parent::__construct('api.pushover.net:80', $level, $bubble);
     $this->token = $token;
     $this->user = $user;
     $this->title = $title ?: gethostname();
 }
開發者ID:wushian,項目名稱:MDD,代碼行數:14,代碼來源:PushoverHandler.php

示例3: __construct

 /**
  * @param string $token Log token supplied by LogEntries
  * @param boolean $useSSL Whether or not SSL encryption should be used.
  * @param int $level The minimum logging level to trigger this handler
  * @param boolean $bubble Whether or not messages that are handled should bubble up the stack.
  *
  * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
  */
 public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true)
 {
     if ($useSSL && !extension_loaded('openssl')) {
         throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler');
     }
     $endpoint = $useSSL ? 'ssl://data.logentries.com:443' : 'data.logentries.com:80';
     parent::__construct($endpoint, $level, $bubble);
     $this->logToken = $token;
 }
開發者ID:saj696,項目名稱:pipe,代碼行數:17,代碼來源:LogEntriesHandler.php

示例4: write

 public function write(array $record)
 {
     foreach ($this->users as $user) {
         $this->user = $user;
         parent::write($record);
         $this->closeSocket();
     }
     $this->user = null;
 }
開發者ID:reTHINK-project,項目名稱:dev-IdPServer-phpOIDC,代碼行數:9,代碼來源:PushoverHandler.php

示例5: __construct

 /**
  * @param string     $token    Log token supplied by Logmatic.
  * @param string     $hostname Host name supplied by Logmatic.
  * @param string     $appname  Application name supplied by Logmatic.
  * @param bool       $useSSL   Whether or not SSL encryption should be used.
  * @param int|string $level    The minimum logging level to trigger this handler.
  * @param bool       $bubble   Whether or not messages that are handled should bubble up the stack.
  *
  * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
  */
 public function __construct(string $token, string $hostname = '', string $appname = '', bool $useSSL = true, $level = Logger::DEBUG, bool $bubble = true)
 {
     if ($useSSL && !extension_loaded('openssl')) {
         throw new MissingExtensionException('The OpenSSL PHP extension is required to use SSL encrypted connection for LogmaticHandler');
     }
     $endpoint = $useSSL ? 'ssl://api.logmatic.io:10515' : 'api.logmatic.io:10514';
     $endpoint .= '/v1/';
     parent::__construct($endpoint, $level, $bubble);
     $this->logToken = $token;
     $this->hostname = $hostname;
     $this->appname = $appname;
 }
開發者ID:earncef,項目名稱:monolog,代碼行數:22,代碼來源:LogmaticHandler.php

示例6: processRecord

 /**
  * @param array $rawrecord
  * @return array
  */
 protected function processRecord(array $rawrecord)
 {
     $record = parent::processRecord($rawrecord);
     $record['datetime'] = $record['datetime']->format(\DateTime::ISO8601);
     if (empty($record['extra'])) {
         unset($record['extra']);
     }
     if (isset($record['context'])) {
         $context = $record['context'];
         if (isset($context['exception'])) {
             $record['exception'] = $this->parseException($context['exception']);
             unset($record['context']['exception']);
         }
     }
     if (empty($record['context'])) {
         unset($record['context']);
     }
     if (!empty($record['level_name'])) {
         $record['level'] = $record['level_name'];
         unset($record['level_name']);
     }
     return $record;
 }
開發者ID:pilebones,項目名稱:logstashMonologHandlerBundle,代碼行數:27,代碼來源:LogstashHandler.php

示例7: write

 public function write(array $record)
 {
     parent::write($record);
     $this->closeSocket();
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:5,代碼來源:PushoverHandler.php

示例8: write

 /**
  * {@inheritdoc}
  *
  * @param array $record
  */
 protected function write(array $record)
 {
     parent::write($record);
     $res = $this->getResource();
     if (is_resource($res)) {
         @fread($res, 2048);
     }
     $this->closeSocket();
 }
開發者ID:Roc4rdho,項目名稱:app,代碼行數:14,代碼來源:SlackHandler.php

示例9: write

 /**
  * {@inheritdoc}
  *
  * @param array $record
  */
 protected function write(array $record)
 {
     try {
         parent::write($record);
         $this->closeSocket();
     } catch (\Exception $e) {
         // socket creation failed. Cannot connect to hipchat API.
     }
 }
開發者ID:alextartan,項目名稱:monolog,代碼行數:14,代碼來源:HipChatHandler.php

示例10: getFormatter

 public function getFormatter()
 {
     $formatter = parent::getFormatter();
     $this->slackRecord->setFormatter($formatter);
     return $formatter;
 }
開發者ID:naldz,項目名稱:cyberden,代碼行數:6,代碼來源:SlackHandler.php


注:本文中的Monolog\Handler\SocketHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。