PluginProbe
SlimStat Analytics / trunk
SlimStat Analytics vtrunk
5.5.0 5.4.12 4.7.4 4.7.4.1 4.7.5 4.7.5.1 4.7.5.2 4.7.5.3 4.7.6 4.7.6.1 4.7.7 4.7.8 4.7.8.1 4.7.8.2 4.7.8.3 4.7.9 4.7.9.1 4.8 4.8.1 4.8.2 4.8.3 4.8.4 4.8.4.1 4.8.5 4.8.5.1 All 212 releases
wp-slimstat / src / Exception / LogException.php

LogException.php in SlimStat Analytics trunk, at src/Exception/LogException.php

28 lines 633 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SlimStat\Exception;
4
5 use Exception;
6 use wp_slimstat as SlimStat;
7
8 class LogException extends Exception
9 {
10 public function __construct($message, $code = 0, ?Exception $previous = null)
11 {
12 parent::__construct($message, $code, $previous);
13
14 SlimStat::log($this->generateLogMessage($message, $code), 'error');
15 }
16
17 private function generateLogMessage($message, $code)
18 {
19 return sprintf(
20 __('Exception occurred: [Code %d] %s at %s:%d', 'wp-slimstat'),
21 $code,
22 $message,
23 $this->getFile(),
24 $this->getLine()
25 );
26 }
27 }
28