|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright (c) 2018 Justin Kuenzel (jukusoft.com) |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
|
|
* you may not use this file except in compliance with the License. |
|
8
|
|
|
* You may obtain a copy of the License at |
|
9
|
|
|
* |
|
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11
|
|
|
* |
|
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15
|
|
|
* See the License for the specific language governing permissions and |
|
16
|
|
|
* limitations under the License. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Project: JuKuCMS |
|
22
|
|
|
* License: Apache 2.0 license |
|
23
|
|
|
* User: Justin |
|
24
|
|
|
* Date: 21.08.2018 |
|
25
|
|
|
* Time: 20:25 |
|
26
|
|
|
*/ |
|
27
|
|
|
|
|
28
|
|
|
namespace Plugin\Rollbar; |
|
29
|
|
|
|
|
30
|
|
|
use LogProvider; |
|
31
|
|
|
|
|
32
|
|
|
if (!defined('ROLLBAR_SDK_DIR')) { |
|
33
|
|
|
define('ROLLBAR_SDK_DIR', dirname(__FILE__) . "/../rollbar-php-1.6.2/"); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
class RollbarLoggingProvider implements LogProvider { |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* initialize logging provider |
|
40
|
|
|
*/ |
|
41
|
|
|
public function init () { |
|
42
|
|
|
// TODO: Implement init() method. |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* log message |
|
47
|
|
|
*/ |
|
48
|
|
|
public function log (string $level, string $message, $args = array()) { |
|
49
|
|
|
// TODO: Implement log() method. |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* lazy logging - after generating page write logs to file or send them to server |
|
54
|
|
|
*/ |
|
55
|
|
|
public function send () { |
|
56
|
|
|
// TODO: Implement send() method. |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public static function addRollbarClassloader (array $params) { |
|
|
|
|
|
|
60
|
|
|
//add classloader for facebook sdk |
|
61
|
|
|
ClassLoader::addLoader("Rollbar", function (string $class_name) { |
|
|
|
|
|
|
62
|
|
|
$path = ROLLBAR_SDK_DIR . str_replace("\\", "/", $class_name) . ".php"; |
|
63
|
|
|
|
|
64
|
|
|
if (file_exists($path)) { |
|
65
|
|
|
require($path); |
|
66
|
|
|
} else { |
|
67
|
|
|
echo "Couldnt load rollbar class: " . $class_name . " (expected path: " . $path . ")!"; |
|
68
|
|
|
exit; |
|
|
|
|
|
|
69
|
|
|
} |
|
70
|
|
|
}); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
?> |
|
|
|
|
|
|
76
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.