| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace WCPOS\Vendor\Sentry\Logs; |
| 5 |
|
| 6 |
use WCPOS\Vendor\Sentry\Attributes\AttributeBag; |
| 7 |
class Log |
| 8 |
{ |
| 9 |
/** |
| 10 |
* @var float |
| 11 |
*/ |
| 12 |
private $timestamp; |
| 13 |
/** |
| 14 |
* @var string |
| 15 |
*/ |
| 16 |
private $traceId; |
| 17 |
/** |
| 18 |
* @var LogLevel |
| 19 |
*/ |
| 20 |
private $level; |
| 21 |
/** |
| 22 |
* @var string |
| 23 |
*/ |
| 24 |
private $body; |
| 25 |
/** |
| 26 |
* @var AttributeBag |
| 27 |
*/ |
| 28 |
private $attributes; |
| 29 |
public function __construct(float $timestamp, string $traceId, LogLevel $level, string $body) |
| 30 |
{ |
| 31 |
$this->timestamp = $timestamp; |
| 32 |
$this->traceId = $traceId; |
| 33 |
$this->level = $level; |
| 34 |
$this->body = $body; |
| 35 |
$this->attributes = new AttributeBag(); |
| 36 |
} |
| 37 |
public function getTimestamp() : float |
| 38 |
{ |
| 39 |
return $this->timestamp; |
| 40 |
} |
| 41 |
public function setTimestamp(float $timestamp) : self |
| 42 |
{ |
| 43 |
$this->timestamp = $timestamp; |
| 44 |
return $this; |
| 45 |
} |
| 46 |
public function getTraceId() : string |
| 47 |
{ |
| 48 |
return $this->traceId; |
| 49 |
} |
| 50 |
public function setTraceId(string $traceId) : self |
| 51 |
{ |
| 52 |
$this->traceId = $traceId; |
| 53 |
return $this; |
| 54 |
} |
| 55 |
public function getLevel() : LogLevel |
| 56 |
{ |
| 57 |
return $this->level; |
| 58 |
} |
| 59 |
public function setLevel(LogLevel $level) : self |
| 60 |
{ |
| 61 |
$this->level = $level; |
| 62 |
return $this; |
| 63 |
} |
| 64 |
public function getPsrLevel() : string |
| 65 |
{ |
| 66 |
return $this->level->toPsrLevel(); |
| 67 |
} |
| 68 |
public function getBody() : string |
| 69 |
{ |
| 70 |
return $this->body; |
| 71 |
} |
| 72 |
public function setBody(string $body) : self |
| 73 |
{ |
| 74 |
$this->body = $body; |
| 75 |
return $this; |
| 76 |
} |
| 77 |
public function attributes() : AttributeBag |
| 78 |
{ |
| 79 |
return $this->attributes; |
| 80 |
} |
| 81 |
/** |
| 82 |
* @param mixed $value |
| 83 |
*/ |
| 84 |
public function setAttribute(string $key, $value) : self |
| 85 |
{ |
| 86 |
$this->attributes->set($key, $value); |
| 87 |
return $this; |
| 88 |
} |
| 89 |
} |
| 90 |
|