diff --git a/Api/LoggerManagementInterface.php b/Api/LoggerManagementInterface.php index e08d08b..e7ef030 100644 --- a/Api/LoggerManagementInterface.php +++ b/Api/LoggerManagementInterface.php @@ -14,6 +14,7 @@ interface LoggerManagementInterface * @param int $severity * @param bool $createIssue * @param \Exception $exception + * @param \DateTime $timestamp * @return bool */ public function addEvent( @@ -23,7 +24,8 @@ public function addEvent( string $identifierValue = '', int $severity = 1, bool $createIssue = true, - \Exception $exception = null + \Exception $exception = null, + \DateTime $timestamp = null ): bool; /** diff --git a/Service/LoggerManagement.php b/Service/LoggerManagement.php index 6a1ddec..da8f5c4 100644 --- a/Service/LoggerManagement.php +++ b/Service/LoggerManagement.php @@ -35,7 +35,7 @@ class LoggerManagement implements LoggerManagementInterface * @var ReportManagementInterface */ private $reportManagement; - + public function __construct( LogInterfaceFactory $logFactory, LogRepositoryInterface $logRepository, @@ -70,7 +70,8 @@ public function addEvent( string $identifierValue = '', int $severity = 1, bool $createIssue = true, - \Exception $exception = null + \Exception $exception = null, + \DateTime $timestamp = null ): bool { $issueId = 0; if ($createIssue === true) { @@ -84,6 +85,7 @@ public function addEvent( $log->setSeverity($severity); $log->setIdentifierLabel($identifierLabel); $log->setIdentifierValue($identifierValue); + $timestamp ? $log->setTimestamp($timestamp->format('M j, Y g:i:s A')) : $log->setTimestamp(date('M j, Y g:i:s A')); $this->logRepository->save($log); return true; } diff --git a/etc/db_schema.xml b/etc/db_schema.xml index 77c0312..b1911b5 100644 --- a/etc/db_schema.xml +++ b/etc/db_schema.xml @@ -8,7 +8,7 @@ - +