|
12 | 12 | use \InvalidArgumentException; |
13 | 13 | use \PDO; |
14 | 14 | use \PDOException; |
15 | | -use \Rollbar; |
16 | 15 | use \RuntimeException; |
17 | 16 |
|
18 | 17 | class Logger extends LoggerMVCLib { |
19 | 18 |
|
20 | | - protected static $event_types = null; |
21 | | - protected static $identified_as = null; |
22 | | - protected static $rollbar_available = false; |
23 | | - |
24 | | - public static function getIdentity() { |
25 | | - return self::$identified_as; |
26 | | - } |
27 | | - |
28 | | - public static function getIdentityAsRollbar() { |
29 | | - $user = self::getIdentity(); |
30 | | - if (!$user) { return null; } |
31 | | - return [ |
32 | | - 'email' => $user->getEmail(), |
33 | | - 'id' => $user->getId(), |
34 | | - 'username' => $user->getUsername(), |
35 | | - ]; |
36 | | - } |
37 | | - |
38 | | - public static function getTimingHeader($tags = true) { |
39 | | - $buffer = parent::getTimingHeader($tags); |
40 | | - if (self::$rollbar_available) { |
41 | | - ob_start(); |
42 | | - require('../templates/rollbar.inc.js.phtml'); |
43 | | - $buffer .= ob_get_clean(); |
44 | | - } |
45 | | - return $buffer; |
46 | | - } |
47 | | - |
48 | | - public static function identifyAs(User $user) { |
49 | | - self::$identified_as = $user; |
50 | | - } |
51 | | - |
52 | | - public static function initialize($override = false) { |
53 | | - parent::initialize($override); |
54 | | - if (Common::$config->rollbar->access_token_server) { |
55 | | - self::$rollbar_available = true; |
56 | | - |
57 | | - $rollbar_handle_exceptions = false; |
58 | | - $rollbar_handle_errors = true; |
59 | | - $rollbar_handle_fatal = true; |
60 | | - |
61 | | - Rollbar::init( |
62 | | - [ |
63 | | - 'access_token' => Common::$config->rollbar->access_token_server, |
64 | | - 'code_version' => VersionInfo::$version->bnetdocs[0], |
65 | | - 'environment' => Common::$config->rollbar->environment, |
66 | | - 'person_fn' => 'Logger::getIdentityAsRollbar', |
67 | | - 'use_error_reporting' => true, |
68 | | - ], |
69 | | - $rollbar_handle_exceptions, |
70 | | - $rollbar_handle_errors, |
71 | | - $rollbar_handle_fatal |
72 | | - ); |
73 | | - } |
74 | | - } |
75 | | - |
76 | | - public static function logException(Exception $exception) { |
77 | | - parent::logException($exception); |
78 | | - if (self::$rollbar_available) { |
79 | | - Rollbar::report_exception($exception); |
80 | | - } |
81 | | - } |
| 19 | + protected static $event_types = null; |
82 | 20 |
|
83 | 21 | public static function &getAllEvents() { |
84 | 22 | $event_log = []; |
|
0 commit comments