Logging
The Logging system allows you to record messages to a log file for debugging and monitoring purposes. The Ecommerce\Supports\Facades\Log facade provides a static interface to the underlying LogManager. By default, logs are written to droip-ecommerce.log in the wp-content directory.
Logging Messages
Record messages at various severity levels.
Info Level
Log informational messages.
Description:
The info() method records interesting events.
Method Signature:
public static function info(string $message): void
Examples:
use Ecommerce\Supports\Facades\Log;
Log::info('Order #123 created successfully.');
Error Level
Log runtime errors.
Description:
The error() method records runtime errors that do not require immediate action but should typically be logged and monitored.
Method Signature:
public static function error(string $message): void
Examples:
try {
// ...
} catch (Exception $e) {
Log::error('Payment failed: ' . $e->getMessage());
}
Warning Level
Log warning conditions.
Description:
The warning() method records exceptional occurrences that differ from normal flow but are not errors.
Method Signature:
public static function warning(string $message): void
Examples:
Log::warning('Stock is running low for product #55.');
Debug Level
Log debug information.
Description:
The debug() method records detailed debug information.
Method Signature:
public static function debug(string $message): void
Examples:
Log::debug('Payload received: ' . json_encode($data));
Other Levels
Emergency, Alert, and Critical levels.
Description:
The system also supports emergency(), alert(), and critical() methods for higher severity issues, following RFC 5424 standards.
Examples:
Log::critical('Database connection lost!');
Log::alert('Website is down!');