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


PHP Logger::debug方法代码示例

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


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

示例1: debug

 /**
  * @param       $message
  * @param array $extra
  *
  * @return $this
  */
 public function debug($message, $extra = [])
 {
     if (getenv('DEBUG')) {
         $this->logger->debug($message, $extra);
     }
     return $this;
 }
开发者ID:allansun,项目名称:docker-cloud-php-api,代码行数:13,代码来源:Logger.php

示例2: register

 /**
  * @param $queueId
  * @param $instance
  * @return Worker
  */
 public function register($queueId, $instance)
 {
     /** @var EntityManager $em */
     $em = $this->doctrine->getManager();
     $host = gethostname();
     $pid = getmypid();
     /** @var Worker $worker */
     $worker = $this->getWorker(['queue' => $queueId, 'instance' => $instance, 'host' => $host]);
     if ($worker == null) {
         $worker = new Worker();
         $worker->setHost($host);
         $worker->setInstance($instance);
         $worker->setQueue($queueId);
         $worker->setStatus(Worker::STATUS_IDLE);
         $worker->setLastChangeDate(new \Datetime());
         $worker->setPid($pid);
     } else {
         $worker->setStatus(Worker::STATUS_IDLE);
         $worker->setLastChangeDate(new \Datetime());
         $worker->setPid($pid);
     }
     $em->persist($worker);
     $em->flush();
     $this->logger->debug("Registered worker entity", $worker->__toArray());
     return $worker;
 }
开发者ID:keboola,项目名称:syrup-queue,代码行数:31,代码来源:WorkerManager.php

示例3: run

 /**
  * @return void
  */
 public function run()
 {
     $logger = new Logger('default');
     $sagaFactory = new GenericSagaFactory();
     $sagaStorage = new MemorySagaStorage();
     $sagaRepository = new SagaRepository($sagaStorage, new JsonSerializer());
     $resolver = new SimpleAssociationValueResolver();
     $sagaManager = new SimpleSagaManager([ToDoSaga::class], $sagaRepository, $resolver, $sagaFactory);
     $eventBus = new SimpleEventBus([]);
     $eventBus->setLogger(new EventLogger($logger));
     $eventBus->addHandler(Event::class, $sagaManager);
     $eventStore = new EventStore($eventBus, new MemoryEventStorage(), new JsonSerializer(), new EventClassMap([ToDoItemCreated::class, ToDoItemDone::class, DeadlineExpired::class]));
     $factory = new GenericAggregateFactory(ToDoItem::class);
     $repository = new EventSourcingRepository($factory, $eventStore);
     $commandHandler = new ToDoCommandHandler($repository);
     $commandBus = new SimpleCommandBus([CreateToDoItem::class => $commandHandler, MarkItemDone::class => $commandHandler]);
     $loggingCommandInterceptor = new LoggingInterceptor(new CommandLogger($logger));
     $commandGateway = new DefaultCommandGateway($commandBus, [$loggingCommandInterceptor]);
     $toCompleteId = Identity::createNew();
     $commandGateway->send(new CreateToDoItem($toCompleteId, "Item to complete", PHP_INT_MAX));
     $sagaIds = $sagaRepository->find(ToDoSaga::class, new AssociationValue('identity', $toCompleteId->getValue()));
     $logger->debug("Active sagas found:", ['count' => count($sagaIds), 'saga' => !empty($sagaIds) ? $sagaStorage->findById($sagaIds[0]->getValue()) : '']);
     $commandGateway->send(new MarkItemDone($toCompleteId));
     $sagaIds = $sagaRepository->find(ToDoSaga::class, new AssociationValue('identity', $toCompleteId->getValue()));
     $logger->debug("Active sagas found:", ['count' => count($sagaIds), 'saga' => !empty($sagaIds) ? $sagaStorage->findById($sagaIds[0]->getValue())['serialized'] : '']);
 }
开发者ID:martyn82,项目名称:apha,代码行数:29,代码来源:ManagedSagaRunner.php

示例4: create

 /**
  * @param $dependency_manager
  * @param $token
  * @return Updater
  */
 public function create($dependency_manager, $full_name, $token)
 {
     $this->logger->debug(__METHOD__);
     switch ($dependency_manager) {
         case 'composer':
             $manager = new ComposerDependencyManager();
             break;
         case 'npm':
             $manager = new NpmDependencyManager();
             break;
         default:
             throw new Exception("{$dependency_manager} is not supported");
             // throw exception
     }
     $client = new Client();
     $this->logger->debug(sprintf("Client::setEnterpriseUrl() %s", $this->git_hub_host));
     if (!empty($this->git_hub_host)) {
         // seems there's a bug here?
         //$client->setEnterpriseUrl($this->git_hub_host);
     }
     $git_hub_repo = new GitHubRepository($client, $full_name, $token, $this->logger);
     $git_hub_repo->authenticate();
     $temp_dir = $this->repository_dir . '/' . rand();
     $file_system = new FileSystem($temp_dir);
     $file_system->makeDirectory();
     return new Updater($git_hub_repo, $manager, $file_system, $this->logger);
 }
开发者ID:RepoMon,项目名称:update,代码行数:32,代码来源:UpdaterFactory.php

示例5: preExecute

 public function preExecute(Request $request)
 {
     $this->componentName = $this->container->getParameter('app_name');
     $this->initLogger();
     $this->initTemp();
     $pathInfo = explode('/', $request->getPathInfo());
     $this->logger->debug('Component ' . $this->componentName . ' started action ' . (count($pathInfo) > 2 ? $pathInfo[2] : ""));
 }
开发者ID:keboola,项目名称:syrup,代码行数:8,代码来源:BaseController.php

示例6: send

 public function send($mobile, $message)
 {
     $data = $this->buildSendData($mobile, $message);
     $this->sendResult = $this->doSend($data);
     if ($this->logger) {
         $this->logger->debug('发送短信', ['mobile' => $mobile, 'message' => $message, 'result' => $this->sendResult, 'method' => __METHOD__]);
     }
 }
开发者ID:windqyoung,项目名称:utils,代码行数:8,代码来源:Sender.php

示例7: processMessage

 protected function processMessage(QueueMessage $message)
 {
     $msg = null;
     if (isset($message->getBody()->Message)) {
         $msg = json_decode($message->getBody()->Message);
     }
     $this->logger->debug("Processing kill message", ['message' => $msg]);
     if ($msg != null) {
         $jobId = $msg->jobId;
         /** @var Job $job */
         $job = $this->elasticsearch->getJob($jobId);
         if (!is_null($job)) {
             if ($job->getProcess()['host'] == gethostname()) {
                 if ($job->getStatus() == Job::STATUS_WAITING) {
                     $job->setStatus(Job::STATUS_CANCELLED);
                     $job->setResult(['message' => 'Job cancelled by user']);
                     $this->getComponentJobMapper($job->getComponent())->update($job);
                     $this->logger->info("receive-kill: Job '{$jobId}' cancelled", ['job' => $job->getData()]);
                     $this->requeue($job->getId());
                 } else {
                     if ($job->getStatus() == Job::STATUS_PROCESSING) {
                         $job->setStatus(Job::STATUS_TERMINATING);
                         $this->getComponentJobMapper($job->getComponent())->update($job);
                         $pid = $job->getProcess()['pid'];
                         // kill child processes
                         $process = new Process('
                         function getcpid() {
                                     cpids=`pgrep -P $1|xargs`
                             for cpid in $cpids;
                             do
                                 echo "$cpid"
                                 getcpid $cpid
                             done
                         }
                         getcpid ' . $pid);
                         $process->run();
                         $processes = $process->getOutput();
                         if ($processes && count(explode("\n", $processes))) {
                             foreach (explode("\n", $processes) as $child) {
                                 if ($child != '') {
                                     (new Process("sudo kill -KILL {$child}"))->run();
                                 }
                             }
                         }
                         // kill parent process
                         posix_kill($pid, SIGKILL);
                         $this->logger->info("receive-kill: Job '{$jobId}' killed", ['job' => $job->getData()]);
                     } else {
                         $this->logger->info("receive-kill: Job is not in waiting or processing state", ['job' => $job->getData()]);
                     }
                 }
             }
         }
     } else {
         $this->logger->warn("Corrupted message received", ['message' => $message]);
     }
     $this->queue->deleteMessage($message);
 }
开发者ID:keboola,项目名称:syrup-queue,代码行数:58,代码来源:ReceiveKillCommand.php

示例8: testLogsLevelAndLevelName

 public function testLogsLevelAndLevelName()
 {
     $this->logger->debug('debug message');
     $this->logger->critical('critical message');
     $sql = 'SELECT * FROM logs WHERE level_name = \'%s\'';
     $debugLog = $this->pdo->query(sprintf($sql, 'DEBUG'))->fetch();
     $criticalLog = $this->pdo->query(sprintf($sql, 'CRITICAL'))->fetch();
     $this->assertNotEmpty($debugLog);
     $this->assertNotEmpty($criticalLog);
     $this->assertEquals($debugLog['message'], 'debug message');
     $this->assertEquals($criticalLog['message'], 'critical message');
 }
开发者ID:kafene,项目名称:monolog-pdo-handler,代码行数:12,代码来源:PdoHandlerTest.php

示例9: __construct

 /**
  * @param Logger   $log
  * @param array $phpcs - ['encoding' => '....', 'standard' => '...']
  */
 public function __construct(Logger $log, array $config)
 {
     $this->log = $log;
     if (!empty($config['installed_paths'])) {
         $GLOBALS['PHP_CODESNIFFER_CONFIG_DATA'] = array('installed_paths' => str_replace('%root%', dirname(__DIR__), $config['installed_paths']));
         $this->log->debug("installed_paths=" . $GLOBALS['PHP_CODESNIFFER_CONFIG_DATA']['installed_paths']);
     }
     $this->phpcs = new \PHP_CodeSniffer($verbosity = 0, $tabWidth = 0, $config['encoding'], $interactive = false);
     $this->log->debug("PhpCs config", $config);
     $this->phpcs->cli->setCommandLineValues(['--report=json', '--standard=' . $config['standard']]);
     $this->phpcs->initStandard($config['standard']);
 }
开发者ID:WhoTrades,项目名称:phpcs-stash,代码行数:16,代码来源:PhpCs.php

示例10: process

 /**
  * Gets a message from RabbitMQ, checks it's a valid transaction and saves it into DB.
  *
  * @param AMQPMessage $rawMessage
  */
 public function process(AMQPMessage $rawMessage)
 {
     $this->logger->debug('Processing message ' . $rawMessage->body);
     try {
         $message = Transaction::extractFromJson($rawMessage->body);
         $message->checkSanity();
         $this->messageDbModel->save($message);
     } catch (Exception $e) {
         // either transaction contains invalid data or there was an error in db
         $this->logger->warn($e->getMessage());
     }
 }
开发者ID:picahielos,项目名称:mtp,代码行数:17,代码来源:MessageProcessor.php

示例11: __call

 /**
  * Вызывает соответствующий метод в конкретной реализации,
  * самостоятельно занимаясь кэшированием, логгированием
  * и измерением времени
  *
  * @param string $method Вызываемый метод
  * @param array  $args   Переданные в метод аргументы
  *
  * @return Response
  * @throws ConfigurationErrorException
  * @throws \InvalidArgumentException
  */
 public function __call($method, array $args = [])
 {
     $cacheKey = md5(serialize(func_get_args()));
     $args = $this->createArgs($args);
     $timer = $this->pinba->start(['call' => sprintf('%s->%s', get_class($this), $method), 'args' => $args]);
     $this->logger->info(sprintf('%s->%s', get_class($this), $method), $args);
     $this->checkIsConfigured();
     $item = $this->cacher->getItem($cacheKey);
     $inCache = !$item->isMiss();
     $this->logger->info(sprintf('item found in cache: %s', $inCache ? 'yes' : 'no'));
     if ($inCache) {
         $this->logger->info('get from cache');
         $response = $item->get();
     } else {
         $this->logger->info('get from source');
         $response = $this->implementation($method, $args);
         $expiresDefault = array_key_exists('default', $this->cacherExpires) ? $this->cacherExpires['default'] : 0;
         $expires = array_key_exists($method, $this->cacherExpires) ? $this->cacherExpires[$method] : $expiresDefault;
         $item->set($response, $expires);
         if (!$response->isOk()) {
             $this->logger->error('error response', [$response->getError()]);
         } else {
             $this->logger->debug('successful response', [$response->getContent()]);
         }
     }
     $this->pinba->stop($timer);
     $this->logger->info('pinba', $this->pinba->info($timer));
     return $response;
 }
开发者ID:itmh,项目名称:service-tools,代码行数:41,代码来源:Service.php

示例12: sendRequest

 private function sendRequest($url, $method, $request)
 {
     try {
         if (strtoupper($method) == 'GET') {
             $this->logger->debug("Sending GET request to {$url}, query=" . json_encode($request));
             $reply = $this->httpClient->get($url, ['query' => $request]);
         } else {
             $this->logger->debug("Sending {$method} request to {$url}, body=" . json_encode($request));
             $reply = $this->httpClient->send($this->httpClient->createRequest($method, $url, ['body' => json_encode($request)]));
         }
     } catch (RequestException $e) {
         //Stash error: it can't send more then 1mb of json data. So just skip suck pull requests or files
         $this->logger->debug("Request finished with error: " . $e->getMessage());
         if ($e->getMessage() == 'cURL error 56: Problem (3) in the Chunked-Encoded data') {
             throw new Exception\StashJsonFailure($e->getMessage(), $e->getRequest(), $e->getResponse(), $e);
         } else {
             throw $e;
         }
     }
     $this->logger->debug("Request finished");
     $json = (string) $reply->getBody();
     //an: пустой ответ - значит все хорошо
     if (empty($json)) {
         return true;
     }
     $data = json_decode($json, true);
     if ($data === null && $data != 'null') {
         $this->logger->addError("Invalid json received", ['url' => $url, 'method' => $method, 'request' => $request, 'reply' => $json]);
         throw new \Exception('invalid_json_received');
     }
     return $data;
 }
开发者ID:WhoTrades,项目名称:phpcs-stash,代码行数:32,代码来源:StashApi.php

示例13: debug

 public function debug($message, array $args = [], array $context = [])
 {
     if (count($args)) {
         $message = vsprintf($message, $args);
     }
     return parent::debug($message, $context);
 }
开发者ID:acgrid,项目名称:adbot,代码行数:7,代码来源:Logger.php

示例14: run

 /**
  * @return void
  */
 public function run()
 {
     $logger = new Logger('default');
     $serializer = new JsonSerializer();
     $stateStorage = new MemoryStateStorage();
     $toDoItemProjections = new ToDoItemProjections($stateStorage);
     $eventStore = new EventStore(new SimpleEventBus([ToDoItemCreated::class => [$toDoItemProjections], ToDoItemDone::class => [$toDoItemProjections], DeadlineExpired::class => [$toDoItemProjections]]), new MemoryEventStorage(), $serializer, new EventClassMap([ToDoItemCreated::class, ToDoItemDone::class, DeadlineExpired::class]));
     $repository = new EventSourcingRepository(new GenericAggregateFactory(ToDoItem::class), $eventStore);
     $toDoItemCommandHandler = new ToDoCommandHandler($repository);
     $commandGateWay = new DefaultCommandGateway(new SimpleCommandBus([CreateToDoItem::class => $toDoItemCommandHandler, MarkItemDone::class => $toDoItemCommandHandler]), [new LoggingInterceptor(new CommandLogger($logger))]);
     $toDoId = Identity::createNew();
     $commandGateWay->send(new CreateToDoItem($toDoId, "Wash the dishes", 5));
     $logger->debug("Current state of ToDoItem", ['item' => $serializer->serialize($stateStorage->find($toDoId->getValue()))]);
     $commandGateWay->send(new MarkItemDone($toDoId));
     $logger->debug("Current state of ToDoItem", ['item' => $serializer->serialize($stateStorage->find($toDoId->getValue()))]);
 }
开发者ID:martyn82,项目名称:apha,代码行数:19,代码来源:AnnotatedAggregateRunner.php

示例15: handleError

 /**
  * Handle PHP error
  * Takes input from PHPs built in error handler logs it
  * throws a jazzee exception to handle if the error reporting level is high enough
  * @param $code
  * @param $message
  * @param $file
  * @param $line
  * @throws \Jazzee\Exception
  */
 public function handleError($code, $message, $file, $line)
 {
     /* Map the PHP error to a Log priority. */
     switch ($code) {
         case E_WARNING:
         case E_USER_WARNING:
             $priority = \Monolog\Logger::WARNING;
             break;
         case E_NOTICE:
         case E_USER_NOTICE:
             $priority = \Monolog\Logger::INFO;
             break;
         case E_ERROR:
         case E_USER_ERROR:
             $priority = \Monolog\Logger::ERROR;
             break;
         default:
             $priority = \Monolog\Logger::INFO;
     }
     // Error reporting is currently turned off or suppressed with @
     if (error_reporting() === 0) {
         $this->_log->debug('Supressed error: ' . $message . ' in ' . $file . ' at line ' . $line);
         return false;
     }
     $this->_log->addRecord($priority, $message . ' in ' . $file . ' at line ' . $line);
     throw new \Exception('Jazzee caught a PHP error: ' . $message . ' in ' . $file . ' at line ' . $line);
 }
开发者ID:Jazzee,项目名称:Jazzee,代码行数:37,代码来源:JazzeePageController.php


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