本文整理汇总了PHP中Psr\Log\LoggerInterface::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerInterface::debug方法的具体用法?PHP LoggerInterface::debug怎么用?PHP LoggerInterface::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psr\Log\LoggerInterface
的用法示例。
在下文中一共展示了LoggerInterface::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
public function __invoke(Request $req, Response $res, callable $next)
{
$res = $next($req, $res);
$identity = $this->authService->getIdentity();
if (!$identity) {
return $res;
}
try {
$user = R::findOne('user', 'mail = ?', [$identity->mail]);
if (!$user) {
$user = R::dispense('user');
$user->uid = $identity->uid;
$user->mail = $identity->mail;
$user->display_name = $identity->displayName;
$user->office_name = $identity->officeName;
$user->authentication_source = $identity->authenticationSource;
$user->password = '';
$user->created = time();
$user->role = 'school';
$this->logger->info(sprintf('User %s imported from sso.sch.gr to database', $identity->mail));
}
$user->last_login = time();
$user_id = R::store($user);
$identityClass = get_class($identity);
$newIdentity = new $identityClass($user_id, $user->uid, $user->mail, $user->display_name, $user->office_name, $user->authentication_source);
$this->authService->getStorage()->write($newIdentity);
} catch (\Exception $e) {
$this->authService->clearIdentity();
$this->flash->addMessage('danger', 'A problem occured storing user in database. <a href="%s" title="SSO logout">SSO Logout</a>');
$this->logger->error('Problem inserting user form CAS in database', $identity->toArray());
$this->logger->debug('Exception', [$e->getMessage(), $e->getTraceAsString()]);
return $res->withRedirect($this->userErrorRedirectUrl);
}
return $res;
}
示例2: listen
/**
* Start the worker and wait for requests
*/
public function listen()
{
$context = new \ZMQContext();
$server = new \ZMQSocket($context, \ZMQ::SOCKET_PULL);
$server->bind('tcp://127.0.0.1:' . ($this->defaultPort + $this->client->getId() - 1));
$this->logger->info('Client worker ' . $this->client . ' is ready');
while (true) {
$request = $server->recv();
$this->logger->debug('Client worker ' . $this->client . ' receiving request : ' . $request);
// Check if the input is valid, ignore if wrong
$request = json_decode($request, true);
if (!$this->isValidInput($request)) {
$this->logger->error('Client worker ' . $this->client . ' received an invalid input');
continue;
}
try {
// Call the right method in the client and push to redis the result
$result = call_user_func_array(array($this->client, $request['command']), $request['parameters']);
} catch (ClientNotReadyException $e) {
$this->logger->warning('Client worker ' . $this->client . ' received a request (#' . $request['invokeId'] . ') whereas the client is not ready. This is normal in case of client reconnection process. Ignoring.');
continue;
}
$key = $this->key . '.client.commands.' . $request['invokeId'];
$this->redis->rpush($key, serialize($result));
$this->redis->expire($key, $this->expire);
}
}
示例3: execute
/**
* @param string $name
* @param mixed $data
* @param int $priority
* @param string $unique
* @return mixed
*/
public function execute($name, $data = null, $priority = self::NORMAL, $unique = null)
{
$client = $this->getClient()->getClient();
if (null !== $this->logger) {
$this->logger->debug("Sent job \"{$name}\" to GearmanClient");
}
$result = null;
switch ($priority) {
case self::LOW:
$result = $client->doLow($name, self::serialize($data), $unique);
break;
case self::HIGH:
$result = $client->doHigh($name, self::serialize($data), $unique);
break;
default:
$result = $client->doNormal($name, self::serialize($data), $unique);
break;
}
if ($client->returnCode() !== GEARMAN_SUCCESS) {
if (null !== $this->logger) {
$this->logger->error("Bad return code");
}
}
if (null !== $this->logger) {
$this->logger->debug("Job \"{$name}\" returned {$result}");
}
return unserialize($result);
}
示例4: handle
/**
* @param Message $message
* @param callable $next
*/
public function handle($message, callable $next)
{
$next($message);
$this->logger->debug(sprintf('CommitsObjectManagerTransaction flushes Object manager after handling command "%s"', $message instanceof NamedMessage ? $message::messageName() : get_class($message)));
$this->om->flush();
$this->logger->debug(sprintf('CommitsObjectManagerTransaction finished handling "%s"', $message instanceof NamedMessage ? $message::messageName() : get_class($message)));
}
示例5: send
/**
* Send request and retrieve response to the connected disque node.
*
* @param array $args
* @return array|int|null|string
*
* @throws CommandException
* @throws StreamException
*/
protected function send(array $args = [])
{
$this->log->debug('send()ing command', $args);
$response = RespUtils::deserialize($this->stream->write(RespUtils::serialize($args)));
$this->log->debug('response', [$response]);
return $response;
}
示例6: consume
/**
* consume.
*
* @param array $options Parameters sent to the processor
*/
public function consume(array $options = array())
{
if (null !== $this->logger) {
$this->logger->debug(sprintf('Start consuming queue %s.', $this->messageProvider->getQueueName()));
}
$this->optionsResolver->setDefaults(array('poll_interval' => 50000));
if ($this->processor instanceof ConfigurableInterface) {
$this->processor->setDefaultOptions($this->optionsResolver);
}
$options = $this->optionsResolver->resolve($options);
if ($this->processor instanceof InitializableInterface) {
$this->processor->initialize($options);
}
while (true) {
while (null !== ($message = $this->messageProvider->get())) {
if (false === $this->processor->process($message, $options)) {
break 2;
}
}
if ($this->processor instanceof SleepyInterface) {
if (false === $this->processor->sleep($options)) {
break;
}
}
usleep($options['poll_interval']);
}
if ($this->processor instanceof TerminableInterface) {
$this->processor->terminate($options);
}
}
示例7: log
/**
* {@inheritdoc}
*/
public function log($message, $level)
{
$message .= ' ' . $this->request->getRequestUri();
if ($this->logLevel >= $level) {
switch ($level) {
case self::EMERGENCY:
$this->logger->emergency($message);
break;
case self::ALERT:
$this->logger->alert($message);
break;
case self::CRITICAL:
$this->logger->critical($message);
break;
case self::ERROR:
$this->logger->error($message);
break;
case self::WARNING:
$this->logger->warning($message);
break;
case self::NOTICE:
$this->logger->notice($message);
break;
case self::INFO:
$this->logger->info($message);
break;
default:
$this->logger->debug($message);
}
}
}
示例8: onEndRequest
/**
* @param EndRequestEvent $event
*/
public function onEndRequest(EndRequestEvent $event)
{
$this->requestLogger->endRequest($event->getDirectResponse());
if ($this->logger) {
$this->logger->debug('Ext.direct response sent: {response}', ['response' => json_encode($event->getDirectResponse())]);
}
}
示例9: handleContext
/**
* @param JwtContext $context
* @throws \BWC\Component\JwtApiBundle\Error\JwtException
*/
public function handleContext(JwtContext $context)
{
if ($this->logger) {
$this->logger->debug('ValidatorHandler', array('context' => $context));
}
$this->validator->validate($context);
}
示例10: cleanUp
public function cleanUp()
{
foreach ($this->handlers as $handler) {
$this->logger->debug('Clear monolog fingers crossed handler');
$handler->clear();
}
}
示例11: cleanFeed
/**
* @param DelegatingSourceCleaner $cleaner
* @param Feed $feed
* @param ThresholdVoterInterface $voter
*
* @return bool
*/
public function cleanFeed(DelegatingSourceCleaner $cleaner, Feed $feed, ThresholdVoterInterface $voter)
{
if (null === ($expireDate = $this->getLastFullImportDate($feed))) {
$this->logger->debug(sprintf('Skipping %s, because it has no recent imports', $feed));
$this->eventDispatcher->dispatch(IoEvents::FEED_CLEANUP_SKIP, new FeedCleanupEvent($feed, 0));
return false;
}
$this->eventDispatcher->dispatch(IoEvents::PRE_CLEAN_FEED, new FeedEvent($feed));
$this->logger->debug(sprintf('Checking sources of %s that have not been visited since %s', $feed, $expireDate->format('Y-m-d H:i:s')));
// get sources that haven't been visited since $expireDate
$sourceRepo = $this->sourceManager->getRepository();
$count = $sourceRepo->countByFeedAndUnvisitedSince($feed, $expireDate);
// fail safe: see if percentage of sources to be removed is not too high
$total = $sourceRepo->countByFeed($feed);
$max = $this->getThreshold($total);
// see if threshold is reached
if ($count > $max) {
$message = sprintf('Stopping cleanup for %s, because %s of %s sources were to be deleted, %s is the maximum.', $feed, $count, $total, $max);
if (!$voter->vote($count, $total, $max, $message)) {
$this->eventDispatcher->dispatch(IoEvents::FEED_CLEANUP_HALT, new FeedCleanupHaltEvent($feed, $count, $total, $max));
return false;
}
}
$this->logger->debug(sprintf('Cleaning %d sources for %s', $count, $feed));
$builder = $sourceRepo->queryByFeedAndUnvisitedSince($feed, $expireDate);
$numCleaned = $cleaner->cleanByQuery($builder->getQuery());
$this->eventDispatcher->dispatch(IoEvents::POST_CLEAN_FEED, new FeedCleanupEvent($feed, $numCleaned));
return $numCleaned;
}
示例12: fire
/**
* @param Job $syncJob Laravel queue job
* @param $arguments
* @return bool
* @throws \Unifact\Connector\Exceptions\HandlerException
*/
public function fire(Job $syncJob, $arguments)
{
try {
$job = $this->jobRepo->findById($arguments['job_id']);
$job->setPreviousStatus($arguments['previous_status']);
$handler = forward_static_call([$job->handler, 'make']);
$this->logger->debug("Preparing Job..");
if (!$handler->prepare()) {
$this->logger->error('Handler returned FALSE in prepare() method, see log for details');
// delete Laravel queue job
$syncJob->delete();
return false;
}
$this->logger->debug("Handling Job..");
if ($handler->handle($job) === false) {
$this->logger->error('Handler returned FALSE in handle() method, see log for details');
// delete Laravel queue job
$syncJob->delete();
return false;
}
$this->logger->debug("Completing Job..");
$handler->complete();
$this->logger->info('Finished Job successfully');
} catch (\Exception $e) {
$this->oracle->exception($e);
$this->logger->error('Exception was thrown in JobQueueHandler::fire method.');
$this->jobRepo->update($arguments['job_id'], ['status' => 'error']);
// delete Laravel queue job
$syncJob->delete();
return false;
}
// delete Laravel queue job
$syncJob->delete();
return true;
}
示例13: getControllerReference
/**
* Returns a ControllerReference object corresponding to $valueObject and $viewType
*
* @param ValueObject $valueObject
* @param string $viewType
*
* @throws \InvalidArgumentException
*
* @return \Symfony\Component\HttpKernel\Controller\ControllerReference|null
*/
public function getControllerReference(ValueObject $valueObject, $viewType)
{
$matchedType = null;
if ($valueObject instanceof Location) {
$matcherProp = 'locationMatcherFactory';
$matchedType = 'Location';
} else {
if ($valueObject instanceof ContentInfo) {
$matcherProp = 'contentMatcherFactory';
$matchedType = 'Content';
} else {
if ($valueObject instanceof Block) {
$matcherProp = 'blockMatcherFactory';
$matchedType = 'Block';
} else {
throw new InvalidArgumentException('Unsupported value object to match against');
}
}
}
$configHash = $this->{$matcherProp}->match($valueObject, $viewType);
if (!is_array($configHash) || !isset($configHash['controller'])) {
return;
}
$this->logger->debug("Matched custom controller '{$configHash['controller']}' for {$matchedType} #{$valueObject->id}");
return new ControllerReference($configHash['controller']);
}
示例14: validateElementWithKeys
/**
* BC compatible version of the signature check
*
* @param SAML2_SignedElement $element
* @param SAML2_Certificate_X509[] $pemCandidates
*
* @throws Exception
*
* @return bool
*/
protected function validateElementWithKeys(SAML2_SignedElement $element, $pemCandidates)
{
$lastException = NULL;
foreach ($pemCandidates as $index => $candidateKey) {
$key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'public'));
$key->loadKey($candidateKey->getCertificate());
try {
/*
* Make sure that we have a valid signature on either the response or the assertion.
*/
$result = $element->validate($key);
if ($result) {
$this->logger->debug(sprintf('Validation with key "#%d" succeeded', $index));
return TRUE;
}
$this->logger->debug(sprintf('Validation with key "#%d" failed without exception.', $index));
} catch (Exception $e) {
$this->logger->debug(sprintf('Validation with key "#%d" failed with exception: %s', $index, $e->getMessage()));
$lastException = $e;
}
}
if ($lastException !== NULL) {
throw $lastException;
} else {
return FALSE;
}
}
示例15: removeInvalidSelf
protected function removeInvalidSelf(LoggerInterface $logger)
{
// Must have "href" attribute.
if (!$this->hasAttribute('href')) {
$logger->debug('Removing ' . $this . '. Requires "href" attribute.');
return true;
}
// Must have either "rel" or "itemprop" attribute, but not both.
$attrCount = 0;
foreach ($this->attributes as $attribute) {
if ($attribute->getName() == 'rel' || $attribute->getName() == 'itemprop') {
++$attrCount;
}
if ($attrCount > 1) {
// If both, then we don't know which one should be kept,
// so we recommend to delete the entire element.
$logger->debug('Removing ' . $this . '. Requires either "rel" or "itemprop" attribute, but not both.');
return true;
}
}
if ($attrCount == 0) {
$logger->debug('Removing ' . $this . '. Requires either "rel" or "itemprop" attribute.');
return true;
}
// If inside "body" element, then we check if allowed.
$body = new Body($this->configuration, 0, 0, 'body');
if ($this->hasAncestor($body) && !$this->isAllowedInBody()) {
$logger->debug('Removing ' . $this . '. Does not have the correct attributes to be allowed inside the "body" element.');
return true;
}
return false;
}