1 <?php
2
3 4 5 6 7 8 9
10
11 namespace triagens\ArangoDb;
12
13 14 15 16 17 18 19 20
21 class Exception extends
22 \Exception
23 {
24 25 26 27 28 29 30
31 public function __construct($message = '', $code = 0, \Exception $previous = null)
32 {
33 if (self::$enableLogging) {
34 @error_log(get_class($this) . ': ' . $message);
35 @error_log('Stack trace:');
36 foreach (explode(PHP_EOL, $this->getTraceAsString()) as $i => $line) {
37 @error_log(' ' . $line);
38 }
39 }
40
41 parent::__construct($message, $code, $previous);
42 }
43
44 45 46
47 public static function enableLogging()
48 {
49 self::$enableLogging = true;
50 }
51
52 53 54
55 public static function disableLogging()
56 {
57 self::$enableLogging = false;
58 }
59
60 private static $enableLogging = false;
61 }
62