PluginProbe
ManageWP Worker / 4.9.25
ManageWP Worker v4.9.25
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / src / Gelf / Message.php

Message.php in ManageWP Worker 4.9.25, at src/Gelf/Message.php

295 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Gelf_Message
4 {
5 /**#@+
6 * Log levels according to syslog priority
7 */
8 const EMERGENCY = 0;
9 const ALERT = 1;
10 const CRITICAL = 2;
11 const ERROR = 3;
12 const WARNING = 4;
13 const NOTICE = 5;
14 const INFO = 6;
15 const DEBUG = 7;
16 /**#@-*/
17
18 /**
19 * @var string
20 */
21 private $version = null;
22
23 /**
24 * @var integer
25 */
26 private $timestamp = null;
27
28 /**
29 * @var string
30 */
31 private $shortMessage = null;
32
33 /**
34 * @var string
35 */
36 private $fullMessage = null;
37
38 /**
39 * @var string
40 */
41 private $facility = null;
42
43 /**
44 * @var string
45 */
46 private $host = null;
47
48 /**
49 * @var integer
50 */
51 private $level = null;
52
53 /**
54 * @var string
55 */
56 private $file = null;
57
58 /**
59 * @var integer
60 */
61 private $line = null;
62
63 /**
64 * @var array
65 */
66 private $data = array();
67
68 /**
69 * @param string $version
70 *
71 * @return Gelf_Message
72 */
73 public function setVersion($version)
74 {
75 $this->version = $version;
76
77 return $this;
78 }
79
80 /**
81 * @return string
82 */
83 public function getVersion()
84 {
85 return $this->version;
86 }
87
88 /**
89 * @param integer $timestamp
90 *
91 * @return Gelf_Message
92 */
93 public function setTimestamp($timestamp)
94 {
95 $this->timestamp = $timestamp;
96
97 return $this;
98 }
99
100 /**
101 * @return integer
102 */
103 public function getTimestamp()
104 {
105 return $this->timestamp;
106 }
107
108 /**
109 * @param string $shortMessage
110 *
111 * @return Gelf_Message
112 */
113 public function setShortMessage($shortMessage)
114 {
115 $this->shortMessage = $shortMessage;
116
117 return $this;
118 }
119
120 /**
121 * @return string
122 */
123 public function getShortMessage()
124 {
125 return $this->shortMessage;
126 }
127
128 /**
129 * @param string $fullMessage
130 *
131 * @return Gelf_Message
132 */
133 public function setFullMessage($fullMessage)
134 {
135 $this->fullMessage = $fullMessage;
136
137 return $this;
138 }
139
140 /**
141 * @return string
142 */
143 public function getFullMessage()
144 {
145 return $this->fullMessage;
146 }
147
148 /**
149 * @param string $facility
150 *
151 * @return Gelf_Message
152 */
153 public function setFacility($facility)
154 {
155 $this->facility = $facility;
156
157 return $this;
158 }
159
160 /**
161 * @return string
162 */
163 public function getFacility()
164 {
165 return $this->facility;
166 }
167
168 /**
169 * @param string $host
170 *
171 * @return Gelf_Message
172 */
173 public function setHost($host)
174 {
175 $this->host = $host;
176
177 return $this;
178 }
179
180 /**
181 * @return string
182 */
183 public function getHost()
184 {
185 return $this->host;
186 }
187
188 /**
189 * @param integer $level
190 *
191 * @return Gelf_Message
192 */
193 public function setLevel($level)
194 {
195 $this->level = $level;
196
197 return $this;
198 }
199
200 /**
201 * @return integer
202 */
203 public function getLevel()
204 {
205 return $this->level;
206 }
207
208 /**
209 * @param string $file
210 *
211 * @return Gelf_Message
212 */
213 public function setFile($file)
214 {
215 $this->file = $file;
216
217 return $this;
218 }
219
220 /**
221 * @return string
222 */
223 public function getFile()
224 {
225 return $this->file;
226 }
227
228 /**
229 * @param integer $line
230 *
231 * @return Gelf_Message
232 */
233 public function setLine($line)
234 {
235 $this->line = $line;
236
237 return $this;
238 }
239
240 /**
241 * @return integer
242 */
243 public function getLine()
244 {
245 return $this->line;
246 }
247
248 /**
249 * @param string $key
250 * @param mixed $value
251 *
252 * @return Gelf_Message
253 */
254 public function setAdditional($key, $value)
255 {
256 $this->data["_".trim($key)] = $value;
257
258 return $this;
259 }
260
261 /**
262 * @return mixed
263 */
264 public function getAdditional($key)
265 {
266 $additional_key = "_".trim($key);
267
268 return isset($this->data[$additional_key]) ? $this->data[$additional_key] : null;
269 }
270
271 /**
272 * @return array
273 */
274 public function toArray()
275 {
276 $messageAsArray = array(
277 'version' => $this->getVersion(),
278 'timestamp' => $this->getTimestamp(),
279 'short_message' => $this->getShortMessage(),
280 'full_message' => $this->getFullMessage(),
281 'facility' => $this->getFacility(),
282 'host' => $this->getHost(),
283 'level' => $this->getLevel(),
284 'file' => $this->getFile(),
285 'line' => $this->getLine(),
286 );
287
288 foreach ($this->data as $key => $value) {
289 $messageAsArray[$key] = $value;
290 }
291
292 return $messageAsArray;
293 }
294 }
295