Final Class yii\symfonymailer\Logger
| Inheritance | yii\ |
|---|---|
| Implements | Psr\ |
| 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\ |
| critical() | Critical conditions. | yii\ |
| debug() | Detailed debug information. | yii\ |
| emergency() | System is unusable. | yii\ |
| error() | Runtime errors that do not require immediate action but should typically be logged and monitored. | yii\ |
| info() | Interesting events. | yii\ |
| log() | Logs with an arbitrary level. | yii\ |
| notice() | Normal but significant events. | yii\ |
| warning() | Exceptional occurrences that are not errors. | yii\ |
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 ( string|\ | ||
| $message | string|\ |
|
| $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 ( string|\ | ||
| $message | string|\ |
|
| $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 ( string|\ | ||
| $message | string|\ |
|
| $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 ( string|\ | ||
| $message | string|\ |
|
| $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 ( string|\ | ||
| $message | string|\ |
|
| $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 ( string|\ | ||
| $message | string|\ |
|
| $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 ( mixed $level, string|\ | ||
| $level | mixed | |
| $message | string|\ |
|
| $context | array | |
| throws | \ |
|
|---|---|---|
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 ( string|\ | ||
| $message | string|\ |
|
| $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 ( string|\ | ||
| $message | string|\ |
|
| $context | array | |
public function warning($message, array $context = []): void
{
Yii::getLogger()->log($message, \yii\log\Logger::LEVEL_WARNING, __METHOD__);
}