Log
Whether you're tracking errors, monitoring user actions, or debugging internal operations, Log provides a clean and centralized way to record those events into a standard log file.
Unlike traditional ad-hoc echo or var_dump() debugging, the Log utility ensures that messages are persistently stored, timestamped, and categorized by severity level — making it suitable for both development and production environments.
Log file location
All log entries are saved in:
/log/snappy-YYYY-MM-DD.logMethods
Log function is available on all your classes in $this object. No need to import you can use it straight away. The output format is like below:
Output
[YYYY-MM-DD hh:mm:ss] [LEVEL] your message content💡 Usage
log info message
$this->logInfo( string $message ): voidmessage
Message to be logged
log debug with optional data & placeholder
$this->logDebug( string $message, array $context = [] ): voidmessage
Message to be logged
context (optional)
An associative array to be parsed to the message
log error message
$this->logError( string $message, array $context = [], string $errornumber = "" ): voidmessage
Message to be logged
context (optional)
An associative array to be parsed to the message
errornumber (optional)
Any error number format as you want for your own reference
Example:
$this->logInfo("This is information");
$this->logDebug("User {name} logged in with ID {id}", ["name" => "John Doe", "id" => 123])
$this->logError(message: "This is error message", errornumber: "A456XX");Output:
[2025-08-07 18:09:27] INFO: This is information
[2025-08-07 18:09:27] DEBUG: User John Doe logged in with ID 123
[2025-08-07 18:09:27] ERROR: #A456XX This is error message #A456XX