Interface ErrorLoggerInterface
Interface for error logging handlers.
Used by the ErrorHandlerMiddleware and global error handlers to log exceptions and errors.
Method Summary
-
alert() public
Action must be taken immediately.
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
-
critical() public
Critical conditions.
Example: Application component unavailable, unexpected exception.
-
debug() public
Detailed debug information.
-
emergency() public
System is unusable.
-
error() public
Runtime errors that do not require immediate action but should typically be logged and monitored.
-
info() public
Interesting events.
Example: User logs in, SQL logs.
-
log() public
Logs with an arbitrary level.
-
logError() public
Log an error to Cake's Log subsystem
-
logException() public
Log an error for an exception with optional request context.
-
notice() public
Normal but significant events.
-
warning() public
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Method Detail
alert() ¶ public
alert(string|Stringable $message, mixed[] $context = []): void
Action must be taken immediately.
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
Parameters
-
string|Stringable$message -
mixed[]$context optional
Returns
voidcritical() ¶ public
critical(string|Stringable $message, mixed[] $context = []): void
Critical conditions.
Example: Application component unavailable, unexpected exception.
Parameters
-
string|Stringable$message -
mixed[]$context optional
Returns
voiddebug() ¶ public
debug(string|Stringable $message, mixed[] $context = []): void
Detailed debug information.
Parameters
-
string|Stringable$message -
mixed[]$context optional
Returns
voidemergency() ¶ public
emergency(string|Stringable $message, mixed[] $context = []): void
System is unusable.
Parameters
-
string|Stringable$message -
mixed[]$context optional
Returns
voiderror() ¶ public
error(string|Stringable $message, mixed[] $context = []): void
Runtime errors that do not require immediate action but should typically be logged and monitored.
Parameters
-
string|Stringable$message -
mixed[]$context optional
Returns
voidinfo() ¶ public
info(string|Stringable $message, mixed[] $context = []): void
Interesting events.
Example: User logs in, SQL logs.
Parameters
-
string|Stringable$message -
mixed[]$context optional
Returns
voidlog() ¶ public
log(mixed $level, string|Stringable $message, mixed[] $context = []): void
Logs with an arbitrary level.
Parameters
-
mixed$level -
string|Stringable$message -
mixed[]$context optional
Returns
voidThrows
Psr\Log\InvalidArgumentExceptionlogError() ¶ public
logError(Cake\Error\PhpError $error, Psr\Http\Message\ServerRequestInterface|null $request = null, bool $includeTrace = false): void
Log an error to Cake's Log subsystem
Parameters
-
Cake\Error\PhpError$error The error to log.
-
Psr\Http\Message\ServerRequestInterface|null$request optional The request if in an HTTP context.
-
bool$includeTrace optional Should the log message include a stacktrace.
Returns
voidlogException() ¶ public
logException(Throwable $exception, Psr\Http\Message\ServerRequestInterface|null $request = null, bool $includeTrace = false): void
Log an error for an exception with optional request context.
Parameters
-
Throwable$exception The exception to log a message for.
-
Psr\Http\Message\ServerRequestInterface|null$request optional The current request if available.
-
bool$includeTrace optional Should the log message include a stacktrace.
Returns
voidnotice() ¶ public
notice(string|Stringable $message, mixed[] $context = []): void
Normal but significant events.
Parameters
-
string|Stringable$message -
mixed[]$context optional
Returns
voidwarning() ¶ public
warning(string|Stringable $message, mixed[] $context = []): void
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Parameters
-
string|Stringable$message -
mixed[]$context optional
Returns
void