1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* KNUT7 K7F (https://marciozebedeu.com/) |
5
|
|
|
* KNUT7 K7F (tm) : Rapid Development Framework (https://marciozebedeu.com/) |
6
|
|
|
* |
7
|
|
|
* Licensed under The MIT License |
8
|
|
|
* For full copyright and license information, please see the LICENSE.txt |
9
|
|
|
* Redistributions of files must retain the above copyright notice. |
10
|
|
|
* |
11
|
|
|
* @link https://github.com/knut7/framework/ for the canonical source repository |
12
|
|
|
* @copyright (c) 2015. KNUT7 Software Technologies AO Inc. (https://marciozebedeu.com/) |
13
|
|
|
* @license https://marciozebedeu.com/license/new-bsd New BSD License |
14
|
|
|
* @author Marcio Zebedeu - [email protected] |
15
|
|
|
* @version 1.0.2 |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
namespace Ballybran\Helpers\Log; |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class Log |
23
|
|
|
* @package Ballybran\Helpers\Log |
24
|
|
|
*/ |
25
|
|
|
class Log |
26
|
|
|
{ |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var |
30
|
|
|
*/ |
31
|
|
|
private $handle; |
32
|
|
|
/** |
33
|
|
|
* @var |
34
|
|
|
*/ |
35
|
|
|
private $filename; |
36
|
|
|
/** |
37
|
|
|
* @var |
38
|
|
|
*/ |
39
|
|
|
private $handles; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* |
43
|
|
|
* @param type $filename |
|
|
|
|
44
|
|
|
* @param null $dir |
|
|
|
|
45
|
|
|
*/ |
46
|
|
|
public function __construct($filename, $dir = null) |
47
|
|
|
{ |
48
|
|
|
|
49
|
|
|
if ($dir != null) { |
|
|
|
|
50
|
|
|
|
51
|
|
|
$this->filename = $dir . $filename; |
52
|
|
|
|
53
|
|
|
} else { |
54
|
|
|
|
55
|
|
|
$this->filename = DIR_LOGS . $filename; |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* |
61
|
|
|
* @param type $message |
62
|
|
|
* @param null $type |
|
|
|
|
63
|
|
|
*/ |
64
|
|
|
public function write($message, $type = null) |
65
|
|
|
{ |
66
|
|
|
if ($this->handle = fopen($this->filename, 'a')) { |
67
|
|
|
if (is_array($message) && $type === 'A') { |
|
|
|
|
68
|
|
|
foreach ($message as $key => $value) { |
69
|
|
|
fwrite($this->handle, date('Y-m-d G:i:s') . ' - ' . print_r($key . " -> " . $value, true) . "\n"); |
70
|
|
|
|
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
if (!empty($message)) { |
74
|
|
|
fwrite($this->handle, date('Y-m-d G:i:s') . ' - ' . print_r($message, true) . "\n"); |
|
|
|
|
75
|
|
|
|
76
|
|
|
} |
77
|
|
|
// to use for get data |
78
|
|
|
|
79
|
|
|
if (is_array($message) && $type == 'F') { |
|
|
|
|
80
|
|
|
foreach ($message as $key => $value) { |
81
|
|
|
fwrite($this->handle, date('Y-m-d G:i:s') . ';' . print_r($key . "=>" . $value, true) . "\n") . "<br>"; |
82
|
|
|
|
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
fclose($this->handle); |
87
|
|
|
if ($this->filename == true) { |
|
|
|
|
88
|
|
|
chmod($this->filename, 0755); |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* |
94
|
|
|
*/ |
95
|
|
|
public function open() |
96
|
|
|
{ |
97
|
|
|
if (file_exists($this->filename) && is_readable($this->filename) && $this->handles = fopen($this->filename, 'r')) { |
98
|
|
|
require_once DIR_FILE . 'View/header.phtml'; |
99
|
|
|
?> |
100
|
|
|
<div class="well"> |
101
|
|
|
<ul> |
102
|
|
|
<?php |
103
|
|
|
while (!feof($this->handles)) { |
104
|
|
|
$content = fgets($this->handles); |
105
|
|
|
|
106
|
|
|
if (trim($content) != "") { |
107
|
|
|
echo "<li style='color: blue'>$content</li>"; |
108
|
|
|
} |
109
|
|
|
} ?> |
110
|
|
|
|
111
|
|
|
</ul> |
112
|
|
|
</div> |
113
|
|
|
<?php |
114
|
|
|
fclose($this->handles); |
115
|
|
|
|
116
|
|
|
} else { |
117
|
|
|
echo "Could not read from {$this->filename}"; |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* |
123
|
|
|
*/ |
124
|
|
|
public function __destruct() |
125
|
|
|
{ |
126
|
|
|
$this->filename; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* |
131
|
|
|
* @param type $files |
132
|
|
|
* @return type |
133
|
|
|
*/ |
134
|
|
|
public function Files($files) |
135
|
|
|
{ |
136
|
|
|
return $this->files = $files; |
|
|
|
|
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
} |
140
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths