Files
Jacek Pyziak 4cf7039759 feat(cronjob): implement CronJobProcessor and CronJobRepository for job scheduling and processing
- Added CronJobProcessor class to handle job creation and queue processing.
- Implemented CronJobRepository for database interactions related to cron jobs.
- Introduced CronJobType class to define job types, priorities, and statuses.
- Created ApiloLogger for logging actions related to job processing.
- Initialized apilo-sync-queue.json for job queue management.
2026-02-27 14:51:30 +01:00

31 lines
914 B
PHP

<?php
namespace Domain\Integrations;
class ApiloLogger
{
/**
* @param \medoo $db
* @param string $action np. 'send_order', 'payment_sync', 'status_sync', 'status_poll'
* @param int|null $orderId
* @param string $message
* @param mixed $context dane do zapisania jako JSON (request/response)
*/
public static function log($db, string $action, ?int $orderId, string $message, $context = null): void
{
$contextJson = null;
if ($context !== null) {
$contextJson = is_string($context)
? $context
: json_encode($context, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
}
$db->insert('pp_log', [
'action' => $action,
'order_id' => $orderId,
'message' => $message,
'context' => $contextJson,
'date' => date('Y-m-d H:i:s'),
]);
}
}