当前位置: 首页>>代码示例>>PHP>>正文


PHP Logger::withName方法代码示例

本文整理汇总了PHP中Monolog\Logger::withName方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::withName方法的具体用法?PHP Logger::withName怎么用?PHP Logger::withName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Monolog\Logger的用法示例。


在下文中一共展示了Logger::withName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * ShellMessagesHandler constructor.
  * @param JupyterBroker $broker
  * @param SocketWrapper $iopubSocket
  * @param SocketWrapper $shellSocket
  * @param Logger $logger
  */
 public function __construct(JupyterBroker $broker, SocketWrapper $iopubSocket, SocketWrapper $shellSocket, Logger $logger)
 {
     $this->shellSoul = new Shell();
     $this->executeAction = new ExecuteAction($broker, $iopubSocket, $shellSocket, $this->shellSoul);
     $this->historyAction = new HistoryAction($broker, $shellSocket);
     $this->kernelInfoAction = new KernelInfoAction($broker, $shellSocket, $iopubSocket);
     $this->shutdownAction = new ShutdownAction($broker, $shellSocket);
     $this->logger = $logger;
     $broker->send($iopubSocket, 'status', ['execution_state' => 'starting'], []);
     $this->shellSoul->setOutput(new KernelOutput($this->executeAction, $this->logger->withName('KernelOutput')));
 }
开发者ID:Litipk,项目名称:Jupyter-PHP,代码行数:18,代码来源:ShellMessagesHandler.php

示例2: registerHandlers

 /**
  *
  */
 private function registerHandlers()
 {
     $this->hbSocket->on('error', new HbErrorHandler($this->logger->withName('HbErrorHandler')));
     $this->hbSocket->on('messages', new HbMessagesHandler($this->logger->withName('HbMessagesHandler')));
     $this->iopubSocket->on('messages', new IOPubMessagesHandler($this->logger->withName('IOPubMessagesHandler')));
     $this->shellSocket->on('messages', new ShellMessagesHandler($this->broker, $this->iopubSocket, $this->shellSocket, $this->logger->withName('ShellMessagesHandler')));
 }
开发者ID:Litipk,项目名称:Jupyter-PHP,代码行数:10,代码来源:KernelCore.php

示例3: testWithName

 /**
  * @covers Monolog\Logger::withName
  */
 public function testWithName()
 {
     $first = new Logger('first', array($handler = new TestHandler()));
     $second = $first->withName('second');
     $this->assertSame('first', $first->getName());
     $this->assertSame('second', $second->getName());
     $this->assertSame($handler, $second->popHandler());
 }
开发者ID:jorjoh,项目名称:Varden,代码行数:11,代码来源:LoggerTest.php

示例4: Logger

require __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
use Litipk\JupyterPHP\System\System;
use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
use Monolog\Handler\FingersCrossedHandler;
use Monolog\Handler\GroupHandler;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogHandler;
use Monolog\Logger;
use Ramsey\Uuid\Uuid;
$system = System::getSystem();
$logger = new Logger('kernel');
$loggerActivationStrategy = new ErrorLevelActivationStrategy(LoggerSettings::getCrossFingersLevel());
if ('root' === $system->getCurrentUser()) {
    if (System::OS_LINUX === $system->getOperativeSystem()) {
        $logger->pushHandler(new FingersCrossedHandler(new GroupHandler([new SyslogHandler('jupyter-php'), new StreamHandler('php://stderr')]), $loggerActivationStrategy, 128));
    }
} else {
    $system->ensurePath($system->getAppDataDirectory() . '/logs');
    $logger->pushHandler(new FingersCrossedHandler(new GroupHandler([new RotatingFileHandler($system->getAppDataDirectory() . '/logs/error.log', 7), new StreamHandler('php://stderr')]), $loggerActivationStrategy, 128));
}
try {
    // Obtain settings
    $connectionSettings = ConnectionSettings::get();
    $connUris = ConnectionSettings::getConnectionUris($connectionSettings);
    $kernelCore = new KernelCore(new JupyterBroker($connectionSettings['key'], $connectionSettings['signature_scheme'], Uuid::uuid4(), $logger->withName('JupyterBroker')), $connUris, $logger->withName('KernelCore'));
    $kernelCore->run();
} catch (\Exception $e) {
    $logger->error('Unexpected error', ['exception' => $e]);
}
开发者ID:Litipk,项目名称:Jupyter-PHP,代码行数:30,代码来源:kernel.php


注:本文中的Monolog\Logger::withName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。