本文整理汇总了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;未经允许,请勿转载。 |
请发表评论