Logger
class Logger implements ILogger
Logs messages and exceptions to files and sends email notifications on critical errors.
Properties
| $directory | name of the directory where errors should be logged |
||
| string|string[]|null | |||
| $fromEmail | sender of email notifications |
||
| $emailSnooze | interval for sending email is 2 days |
||
| $mailer |
Methods
__construct(string|null $directory, string|array|null $email = null, BlueScreen|null $blueScreen = null)
No description
log(mixed $message, string $level = self::INFO)
Logs message or exception to file and sends email notification.
static string
formatMessage(mixed $message)
No description
static string
formatLogLine(mixed $message, string|null $exceptionFile = null)
No description
string
string
logException(Throwable $exception, string|null $file = null)
Logs exception to the file if file doesn't exist.
void
sendEmail(mixed $message)
No description
Details
at line 40
__construct(string|null $directory, string|array|null $email = null, BlueScreen|null $blueScreen = null)
No description
at line 54
log(mixed $message, string $level = self::INFO)
Logs message or exception to file and sends email notification.
For levels ERROR, EXCEPTION and CRITICAL it sends email.
at line 84
static string
formatMessage(mixed $message)
No description
at line 105
static string
formatLogLine(mixed $message, string|null $exceptionFile = null)
No description
at line 116
string
getExceptionFile(Throwable $exception, string $level = self::EXCEPTION)
No description
at line 146
protected string
logException(Throwable $exception, string|null $file = null)
Logs exception to the file if file doesn't exist.
at line 155
protected void
sendEmail(mixed $message)
No description