interface LoggerChannelInterface

Logger channel interface.

This interface defines the full behavior of the central Drupal logger facility. However, when writing code that does logging, use the generic \Psr\Log\LoggerInterface for typehinting instead (you shouldn't need the methods here).

To add a new logger to the system, implement \Psr\Log\LoggerInterface and add a service for that class to a services.yml file tagged with the 'logger' tag. The default logger channel implementation will call the log() method of every logger service with some useful data set in the $context argument of log(): request_uri, referer, ip, user, uid.

SECURITY NOTE: the caller might also set a 'link' in the $context array which will be printed as-is by the dblog module under an "operations" header. Usually this is a "view", "edit" or similar relevant link. Make sure to use proper, secure link generation facilities; some are listed below.

Hierarchy

See also

\Drupal\Core\Logger\RfcLoggerTrait

\Psr\Log\LoggerInterface

\Drupal\Core\Logger\\LoggerChannelFactoryInterface

\Drupal\Core\Utility\LinkGeneratorInterface

\Drupal\Core\Routing\LinkGeneratorTrait::l()

\Drupal\Core\Entity\EntityInterface::link()

File

core/lib/Drupal/Core/Logger/LoggerChannelInterface.php, line 35

Namespace

Drupal\Core\Logger

Members

Name Modifiers Type Description
LoggerChannelInterface::addLogger public function Adds a logger.
LoggerChannelInterface::setCurrentUser public function Sets the current user.
LoggerChannelInterface::setLoggers public function Sets the loggers for this channel.
LoggerChannelInterface::setRequestStack public function Sets the request stack.
LoggerInterface::alert public function Action must be taken immediately.
LoggerInterface::critical public function Critical conditions.
LoggerInterface::debug public function Detailed debug information.
LoggerInterface::emergency public function System is unusable.
LoggerInterface::error public function Runtime errors that do not require immediate action but should typically be logged and monitored.
LoggerInterface::info public function Interesting events.
LoggerInterface::log public function Logs with an arbitrary level.
LoggerInterface::notice public function Normal but significant events.
LoggerInterface::warning public function Exceptional occurrences that are not errors.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Logger!LoggerChannelInterface.php/interface/LoggerChannelInterface/8.1.x