class Logger implements ILogger

Logger.

Properties

$directory

name of the directory where errors should be logged

$email

email or emails to which send error notifications

$fromEmail

sender of email notifications

$emailSnooze

interval for sending email is 2 days

callable $mailer

Methods

__construct(string|null $directory, string|array|null $email = null, BlueScreen|null $blueScreen = null)

No description

log(mixed $message, $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
getExceptionFile(Throwable $exception, string $level = self::EXCEPTION)

No description

string
logException(Throwable $exception, string|null $file = null)

Logs exception to the file if file doesn't exist.

void
sendEmail(mixed $message)

No description

void
defaultMailer(mixed $message, string $email)

Default mailer.

Details

at line 36
__construct(string|null $directory, string|array|null $email = null, BlueScreen|null $blueScreen = null)

No description

Parameters

string|null $directory
string|array|null $email
BlueScreen|null $blueScreen

at line 51
log(mixed $message, $level = self::INFO)

Logs message or exception to file and sends email notification.

Parameters

mixed $message
$level

at line 81
static string formatMessage(mixed $message)

No description

Parameters

mixed $message

Return Value

string

at line 101
static string formatLogLine(mixed $message, string|null $exceptionFile = null)

No description

Parameters

mixed $message
string|null $exceptionFile

Return Value

string

at line 112
string getExceptionFile(Throwable $exception, string $level = self::EXCEPTION)

No description

Parameters

Throwable $exception
string $level

Return Value

string

at line 137
protected string logException(Throwable $exception, string|null $file = null)

Logs exception to the file if file doesn't exist.

Parameters

Throwable $exception
string|null $file

Return Value

string

logged error filename

at line 146
protected void sendEmail(mixed $message)

No description

Parameters

mixed $message

Return Value

void

at line 167
void defaultMailer(mixed $message, string $email)

internal  
 

Default mailer.

Parameters

mixed $message
string $email

Return Value

void