Drupal 8  8.0.2
LoggerChannel Class Reference
Inheritance diagram for LoggerChannel:

Public Member Functions

 __construct ($channel)
 
 log ($level, $message, array $context=array())
 
 setRequestStack (RequestStack $requestStack=NULL)
 
 setCurrentUser (AccountInterface $current_user=NULL)
 
 setLoggers (array $loggers)
 
 addLogger (LoggerInterface $logger, $priority=0)
 

Protected Member Functions

 sortLoggers ()
 

Protected Attributes

 $channel
 
 $levelTranslation
 
 $loggers = array()
 
 $requestStack
 
 $currentUser
 

Detailed Description

Defines a logger channel that most implementations will use.

Constructor & Destructor Documentation

__construct (   $channel)

Constructs a LoggerChannel object

Parameters
string$channelThe channel name for this instance.

Member Function Documentation

addLogger ( LoggerInterface  $logger,
  $priority = 0 
)

{Adds a logger.

Parameters
\Psr\Log\LoggerInterface$loggerThe PSR-3 logger to add.
int$priorityThe priority of the logger being added.
}

Implements LoggerChannelInterface.

log (   $level,
  $message,
array  $context = array() 
)

{}

References Drupal\currentUser(), Drupal\requestStack(), and LoggerChannel\sortLoggers().

Here is the call graph for this function:

setCurrentUser ( AccountInterface  $current_user = NULL)

{Sets the current user.

Parameters
\Drupal\Core\Session\AccountInterface | null$current_userThe current user object.
}

Implements LoggerChannelInterface.

References Drupal\currentUser().

Here is the call graph for this function:

setLoggers ( array  $loggers)

{Sets the loggers for this channel.

Parameters
array$loggersAn array of arrays of keyed by priority.
}

Implements LoggerChannelInterface.

setRequestStack ( RequestStack  $requestStack = NULL)

{Sets the request stack.

Parameters
\Symfony\Component\HttpFoundation\RequestStack | null$requestStackThe current request object.
}

Implements LoggerChannelInterface.

References Drupal\requestStack().

Here is the call graph for this function:

sortLoggers ( )
protected

Sorts loggers according to priority.

Returns
array An array of sorted loggers by priority.

Referenced by LoggerChannel\log().

Here is the caller graph for this function:

Field Documentation

$levelTranslation
protected
Initial value:
= array(
LogLevel::EMERGENCY => RfcLogLevel::EMERGENCY,
LogLevel::ALERT => RfcLogLevel::ALERT,
LogLevel::CRITICAL => RfcLogLevel::CRITICAL,
LogLevel::ERROR => RfcLogLevel::ERROR,
LogLevel::WARNING => RfcLogLevel::WARNING,
LogLevel::NOTICE => RfcLogLevel::NOTICE,
LogLevel::INFO => RfcLogLevel::INFO,
LogLevel::DEBUG => RfcLogLevel::DEBUG,
)

The documentation for this class was generated from the following file: