*/ abstract class AbstractRequestLogStorage extends Configurable implements RequestLogStorageWritable, ServiceManagerAwareInterface { use ServiceManagerAwareTrait; /** * Prepare data to log * * @param RequestInterface $request * @param User $user * @return array */ protected function prepareData(RequestInterface $request, User $user) { $userId = $user->getIdentifier(); if ($userId === null) { $userId = get_class($user); } return [ RequestLogService::USER_ID => $userId, RequestLogService::USER_ROLES => ','. implode(',', $user->getRoles()). ',', RequestLogService::ACTION => $request->getUri()->getPath(), RequestLogService::EVENT_TIME => microtime(true), RequestLogService::DETAILS => json_encode([ 'method' => $request->getMethod(), 'query' => $request->getUri()->getQuery(), ]), ]; } }