Loading composer.json +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ } }, "require": { "php": ">=7.0.0", "php": ">=7.4", "ext-json": "*", "ext-curl": "*" }, Loading src/Certic/Circe/JobResult.php +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ class JobResult foreach ($lines as $line){ $entry = json_decode($line, true); if($entry){ yield $entry; yield new LogEntry($entry); } } } Loading src/Certic/Circe/LogEntry.php 0 → 100644 +49 −0 Original line number Diff line number Diff line <?php declare(strict_types=1); namespace Certic\Circe; class LogEntry { const LEVEL_DEBUG = 0; const LEVEL_INFO = 1; const LEVEL_WARNING = 2; const LEVEL_ERROR = 3; const LEVEL_FATAL = 4; private array $log_dict; public function __construct(array $log_dict){ $this->log_dict = $log_dict; } public function getTimestamp(): \DateTime{ // "%Y-%m-%dT%H:%M:%S.%fZ" if(array_key_exists('timestamp', $this->log_dict)){ return new \DateTime($this->log_dict['timestamp']); } } public function getMessage(): string{ if(array_key_exists('message', $this->log_dict)){ return $this->log_dict['message']; } } public function getLevel(): int{ if(array_key_exists('level', $this->log_dict)){ switch ($this->log_dict['level']){ case 'DEBUG': return self::LEVEL_DEBUG; case 'WARNING': return self::LEVEL_WARNING; case 'ERROR': return self::LEVEL_ERROR; case 'FATAL': case 'CRITICAL': return self::LEVEL_FATAL; default: return self::LEVEL_INFO; } } return self::LEVEL_INFO; } } No newline at end of file Loading
composer.json +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ } }, "require": { "php": ">=7.0.0", "php": ">=7.4", "ext-json": "*", "ext-curl": "*" }, Loading
src/Certic/Circe/JobResult.php +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ class JobResult foreach ($lines as $line){ $entry = json_decode($line, true); if($entry){ yield $entry; yield new LogEntry($entry); } } } Loading
src/Certic/Circe/LogEntry.php 0 → 100644 +49 −0 Original line number Diff line number Diff line <?php declare(strict_types=1); namespace Certic\Circe; class LogEntry { const LEVEL_DEBUG = 0; const LEVEL_INFO = 1; const LEVEL_WARNING = 2; const LEVEL_ERROR = 3; const LEVEL_FATAL = 4; private array $log_dict; public function __construct(array $log_dict){ $this->log_dict = $log_dict; } public function getTimestamp(): \DateTime{ // "%Y-%m-%dT%H:%M:%S.%fZ" if(array_key_exists('timestamp', $this->log_dict)){ return new \DateTime($this->log_dict['timestamp']); } } public function getMessage(): string{ if(array_key_exists('message', $this->log_dict)){ return $this->log_dict['message']; } } public function getLevel(): int{ if(array_key_exists('level', $this->log_dict)){ switch ($this->log_dict['level']){ case 'DEBUG': return self::LEVEL_DEBUG; case 'WARNING': return self::LEVEL_WARNING; case 'ERROR': return self::LEVEL_ERROR; case 'FATAL': case 'CRITICAL': return self::LEVEL_FATAL; default: return self::LEVEL_INFO; } } return self::LEVEL_INFO; } } No newline at end of file