Log
in package
Table of Contents
Constants
- DEFAULT_CHANNEL = 'wsc'
- Default channel name for WSC logs.
Methods
- error() : void
- Logs an error message to the "wsc" logging channel.
- exception() : void
- Logs an exception to the "wsc" logging channel, including its message, stack trace, and code.
- info() : void
- Logs an informational message to the "wsc" logging channel.
- stackTrace() : void|string
- Logs the current stack trace (non-error based).
- warning() : void
- Logs a warning message to the "wsc" logging channel.
Constants
DEFAULT_CHANNEL
Default channel name for WSC logs.
public
mixed
DEFAULT_CHANNEL
= 'wsc'
Methods
error()
Logs an error message to the "wsc" logging channel.
public
static error(string $message[, string $channel = self::DEFAULT_CHANNEL ]) : void
Parameters
- $message : string
-
The message to be logged at the error level.
- $channel : string = self::DEFAULT_CHANNEL
-
Optional custom channel name.
exception()
Logs an exception to the "wsc" logging channel, including its message, stack trace, and code.
public
static exception(Throwable $exception[, string $message = '' ][, string $channel = self::DEFAULT_CHANNEL ]) : void
Parameters
- $exception : Throwable
-
The exception to be logged.
- $message : string = ''
-
Additional message to log with the exception.
- $channel : string = self::DEFAULT_CHANNEL
-
Optional custom channel name.
info()
Logs an informational message to the "wsc" logging channel.
public
static info(string $message[, string $channel = self::DEFAULT_CHANNEL ]) : void
Parameters
- $message : string
-
The message to be logged at the informational level.
- $channel : string = self::DEFAULT_CHANNEL
-
Optional custom channel name.
stackTrace()
Logs the current stack trace (non-error based).
public
static stackTrace([string|null $label = null ][, bool $asString = false ][, string $channel = self::DEFAULT_CHANNEL ]) : void|string
Useful for debugging purposes to trace function/method calls without triggering exceptions. Optionally accepts a label to prefix the trace output for clarity.
Parameters
- $label : string|null = null
-
Optional label to include in the log
- $asString : bool = false
-
If true, returns the stack trace as string instead of logging it
- $channel : string = self::DEFAULT_CHANNEL
Return values
void|stringwarning()
Logs a warning message to the "wsc" logging channel.
public
static warning(string $message[, string $channel = self::DEFAULT_CHANNEL ]) : void
Parameters
- $message : string
-
The message to be logged at the warning level.
- $channel : string = self::DEFAULT_CHANNEL
-
Optional custom channel name.