-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathLogMsg.php
More file actions
112 lines (94 loc) · 1.76 KB
/
Copy pathLogMsg.php
File metadata and controls
112 lines (94 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
namespace Stackify\Log\Entities\Api;
use Stackify\Log\Entities\Api\StackifyError;
class LogMsg
{
/**
* @var string
*/
public $id;
/**
* @var string
*/
public $Msg;
/**
* @var string (JSON)
*/
public $data;
/**
* @var \Stackify\Log\Entities\Api\StackifyError
*/
public $Ex;
/**
* @var string
*/
public $Th;
/**
* @var integer
*/
public $EpochMs;
/**
* @var string
*/
public $Level;
/**
* @var string
*/
public $TransID;
/**
* @var string
*/
public $SrcMethod;
/**
* @var integer
*/
public $SrcLine;
public function __construct($level, $message, $milliseconds)
{
$this->Level = $level;
$this->Msg = $message;
$this->EpochMs = $milliseconds;
}
public function setError(StackifyError $error)
{
$this->Ex = $error;
if (isset($error->Error)) {
$this->SrcMethod = $error->Error->SourceMethod;
if (isset($error->Error->StackTrace[0])) {
$this->SrcLine = $error->Error->StackTrace[0]->LineNum;
}
}
}
/**
* Get log message
*
* @return string
*/
public function getMessage()
{
return $this->Msg;
}
/**
* Set log message
*
* @param string $message New log message
*
* @return void
*/
public function setMessage($message)
{
if (!is_string($message)) {
return;
}
$this->Msg = $message;
}
/**
* Check if log message has error
*
* @return boolean
*/
public function hasError()
{
return $this->Ex && !empty($this->Ex);
}
}