Commit 7ca73d2e authored by gbyte.co's avatar gbyte.co

Make logger class flexible

parent 521b81b3
......@@ -183,7 +183,9 @@ class BatchUrlGenerator {
// todo: Change to different function, as this also checks if current user has access. The user however varies depending if process was started from the web interface or via cron/drush. Use getUrlIfValidWithoutAccessCheck()?
if (!$this->pathValidator->isValid($custom_path['path'])) {
$this->logger->registerError([self::PATH_DOES_NOT_EXIST_OR_NO_ACCESS_MESSAGE, ['@path' => $custom_path['path']]], 'warning');
$this->logger->m(self::PATH_DOES_NOT_EXIST_OR_NO_ACCESS_MESSAGE, ['@path' => $custom_path['path']])
->display('warning', 'administer sitemap settings')
->log('warning');
continue;
}
$url_object = Url::fromUserInput($custom_path['path'], ['absolute' => TRUE]);
......@@ -416,7 +418,9 @@ class BatchUrlGenerator {
['@url' => $GLOBALS['base_url'] . '/sitemap.xml']));
}
else {
// todo: register error.
$this->logger->m('The sitemap generation finished with an error.')
->display('error', 'administer sitemap settings')
->log('error');
}
}
......
......@@ -3,6 +3,8 @@
namespace Drupal\simple_sitemap;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Session\AccountProxyInterface;
use Psr\Log\LoggerInterface;
/**
* Class Logger.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment