Glow.php
965 字节
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
<?php
namespace Facade\FlareClient\Glows;
use Facade\FlareClient\Concerns\UsesTime;
use Facade\FlareClient\Enums\MessageLevels;
class Glow
{
use UsesTime;
/** @var string */
private $name;
/** @var array */
private $metaData;
/** @var string */
private $messageLevel;
/** @var float */
private $microtime;
public function __construct(string $name, string $messageLevel = MessageLevels::INFO, array $metaData = [], ?float $microtime = null)
{
$this->name = $name;
$this->messageLevel = $messageLevel;
$this->metaData = $metaData;
$this->microtime = $microtime ?? microtime(true);
}
public function toArray()
{
return [
'time' => $this->getCurrentTime(),
'name' => $this->name,
'message_level' => $this->messageLevel,
'meta_data' => $this->metaData,
'microtime' => $this->microtime,
];
}
}