Final Class yii\symfonymailer\Logger
Inheritance | yii\symfonymailer\Logger |
---|---|
Implements | Psr\Log\LoggerInterface |
Source Code | https://github.com/yiisoft/yii2-symfonymailer/blob/master/src/Logger.php |
Public Methods
Method | Description | Defined By |
---|---|---|
alert() | Action must be taken immediately. | yii\symfonymailer\Logger |
critical() | Critical conditions. | yii\symfonymailer\Logger |
debug() | Detailed debug information. | yii\symfonymailer\Logger |
emergency() | System is unusable. | yii\symfonymailer\Logger |
error() | Runtime errors that do not require immediate action but should typically be logged and monitored. | yii\symfonymailer\Logger |
info() | Interesting events. | yii\symfonymailer\Logger |
log() | Logs with an arbitrary level. | yii\symfonymailer\Logger |
notice() | Normal but significant events. | yii\symfonymailer\Logger |
warning() | Exceptional occurrences that are not errors. | yii\symfonymailer\Logger |
Method Details
Action must be taken immediately.
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
public void alert ( $message, array $context = [] ) | ||
$message | string|\Stringable | |
$context | array |
public function alert($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_ERROR, __METHOD__);
}
Critical conditions.
Example: Application component unavailable, unexpected exception.
public void critical ( $message, array $context = [] ) | ||
$message | string|\Stringable | |
$context | array |
public function critical($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_ERROR, __METHOD__);
}
Detailed debug information.
public void debug ( $message, array $context = [] ) | ||
$message | string|\Stringable | |
$context | array |
public function debug($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_INFO, __METHOD__);
}
System is unusable.
public void emergency ( $message, array $context = [] ) | ||
$message | string|\Stringable | |
$context | array |
public function emergency($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_ERROR, __METHOD__);
}
Runtime errors that do not require immediate action but should typically be logged and monitored.
public void error ( $message, array $context = [] ) | ||
$message | string|\Stringable | |
$context | array |
public function error($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_ERROR, __METHOD__);
}
Interesting events.
Example: User logs in, SQL logs.
public void info ( $message, array $context = [] ) | ||
$message | string|\Stringable | |
$context | array |
public function info($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_INFO, __METHOD__);
}
Logs with an arbitrary level.
public void log ( $level, $message, array $context = [] ) | ||
$level | mixed | |
$message | string|\Stringable | |
$context | array | |
throws | \Psr\Log\InvalidArgumentException |
---|
public function log($level, $message, array $context = []): void
{
switch ($level) {
case 'error':
case 'critical':
case 'alert':
case 'emergency':
$level = \yii\log\Logger::LEVEL_ERROR;
break;
case 'notice':
case 'warning':
$level = \yii\log\Logger::LEVEL_WARNING;
break;
case 'debug':
case 'info':
$level = \yii\log\Logger::LEVEL_INFO;
break;
default:
$level = \yii\log\Logger::LEVEL_INFO;
}
Yii::getLogger()->log($message, $level, __METHOD__);
}
Normal but significant events.
public void notice ( $message, array $context = [] ) | ||
$message | string|\Stringable | |
$context | array |
public function notice($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_WARNING, __METHOD__);
}
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
public void warning ( $message, array $context = [] ) | ||
$message | string|\Stringable | |
$context | array |
public function warning($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_WARNING, __METHOD__);
}