# wp-slimstat/trunk/src/Exception/LogException.php

SlimStat Analytics, version trunk. 28 lines.

- Page: https://pluginprobe.com/plugins/wp-slimstat/trunk/code/src/Exception/LogException.php
- Raw: https://pluginprobe.com/plugins/wp-slimstat/trunk/raw/src/Exception/LogException.php
- Modified: 2026-06-24T08:58:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-slimstat/trunk/code/src/Exception/LogException.php#L10-L20`.

```php
<?php

namespace SlimStat\Exception;

use Exception;
use wp_slimstat as SlimStat;

class LogException extends Exception
{
    public function __construct($message, $code = 0, ?Exception $previous = null)
    {
        parent::__construct($message, $code, $previous);

        SlimStat::log($this->generateLogMessage($message, $code), 'error');
    }

    private function generateLogMessage($message, $code)
    {
        return sprintf(
            __('Exception occurred: [Code %d] %s at %s:%d', 'wp-slimstat'),
            $code,
            $message,
            $this->getFile(),
            $this->getLine()
        );
    }
}

```
