/
var
/
www
/
html
/
sugar25
/
src
/
Logger
/
Processor
/
Upload File
HOME
<?php /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ namespace Sugarcrm\Sugarcrm\Logger\Processor; use Monolog\LogRecord; /** * Appends the call backtrace to the message */ class RequestProcessor { /** * @param array|LogRecord $record * @return array|LogRecord */ public function __invoke(array|LogRecord $record): array|LogRecord { $variables = []; if (isset($_SESSION['oauth2']['user_id'])) { $variables['User ID'] = $_SESSION['oauth2']['user_id']; } elseif (isset($GLOBALS['current_user'])) { $variables['User ID'] = $GLOBALS['current_user']->id; } if (isset($_SESSION['oauth2']['client_id'])) { $variables['Client ID'] = $_SESSION['oauth2']['client_id']; } if (isset($_SESSION['platform'])) { $variables['Platform'] = $_SESSION['platform']; } foreach ($variables as $name => $value) { $msg = sprintf('; %s=%s', $name, $value); if (is_array($record)) { $record['message'] .= $msg; } else { $record = $record->with(message: $msg); } } return $record; } }