class Logger in Simple XML sitemap 8.2
Same name and namespace in other branches
- 8.3 src/Logger.php \Drupal\simple_sitemap\Logger
- 4.x src/Logger.php \Drupal\simple_sitemap\Logger
Class Logger @package Drupal\simple_sitemap
Hierarchy
- class \Drupal\simple_sitemap\Logger uses StringTranslationTrait
Expanded class hierarchy of Logger
5 files declare their use of Logger
- ArbitraryUrlGenerator.php in src/
Plugin/ simple_sitemap/ UrlGenerator/ ArbitraryUrlGenerator.php - CustomUrlGenerator.php in src/
Plugin/ simple_sitemap/ UrlGenerator/ CustomUrlGenerator.php - EntityMenuLinkContentUrlGenerator.php in src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityMenuLinkContentUrlGenerator.php - EntityUrlGenerator.php in src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityUrlGenerator.php - UrlGeneratorBase.php in src/
Plugin/ simple_sitemap/ UrlGenerator/ UrlGeneratorBase.php
1 string reference to 'Logger'
1 service uses Logger
File
- src/
Logger.php, line 13
Namespace
Drupal\simple_sitemapView source
class Logger {
use StringTranslationTrait;
/*
* Can be debug/info/notice/warning/error.
*/
const LOG_SEVERITY_LEVEL_DEFAULT = 'notice';
/*
* Can be status/warning/error.
*/
const DISPLAY_MESSAGE_TYPE_DEFAULT = 'status';
/**
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
/**
* @var \Drupal\Core\Session\AccountProxyInterface
*/
protected $currentUser;
/**
* @var string
*/
protected $message = '';
/**
* @var array
*/
protected $substitutions = [];
/**
* Logger constructor.
*
* @param $logger
* @param $current_user
*/
public function __construct(LoggerInterface $logger, AccountProxyInterface $current_user) {
$this->logger = $logger;
$this->currentUser = $current_user;
}
/**
* @param $message
* @param array $substitutions
* @return $this
*/
public function m($message, $substitutions = []) {
$this->message = $message;
$this->substitutions = $substitutions;
return $this;
}
/**
* @param string $logSeverityLevel
* @return $this
*/
public function log($logSeverityLevel = self::LOG_SEVERITY_LEVEL_DEFAULT) {
$this->logger
->{$logSeverityLevel}(strtr($this->message, $this->substitutions));
return $this;
}
/**
* @param string $displayMessageType
* @param string $permission
* @return $this
*/
public function display($displayMessageType = self::DISPLAY_MESSAGE_TYPE_DEFAULT, $permission = '') {
if (empty($permission) || $this->currentUser
->hasPermission($permission)) {
drupal_set_message($this
->t($this->message, $this->substitutions), $displayMessageType);
}
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Logger:: |
protected | property | ||
Logger:: |
protected | property | ||
Logger:: |
protected | property | ||
Logger:: |
protected | property | ||
Logger:: |
public | function | ||
Logger:: |
constant | |||
Logger:: |
public | function | ||
Logger:: |
constant | |||
Logger:: |
public | function | ||
Logger:: |
public | function | Logger constructor. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |