in src/Elastic/Monolog/Formatter/ElasticCommonSchemaFormatter.php [135:173]
private function formatContext(array $inContext, array &$outRecord): void
{
$foundLogOriginKeys = false;
// Context should go to the top of the out record
foreach ($inContext as $contextKey => $contextVal) {
// label keys should be sanitized
if ($contextKey === 'labels') {
$outLabels = [];
foreach ($contextVal as $labelKey => $labelVal) {
$outLabels[str_replace(['.', ' ', '*', '\\'], '_', trim($labelKey))] = $labelVal;
}
$outRecord['labels'] = $outLabels;
continue;
}
if ($this->useLogOriginFromContext) {
if (isset(self::$logOriginKeys[$contextKey])) {
$foundLogOriginKeys = true;
continue;
}
}
/**
* Skip 'callType' key. The value is the same as 'type' in the frame returned by debug_backtrace().
*
* @See https://www.php.net/manual/en/function.debug-backtrace.php
*/
if ($contextKey === 'callType') {
continue;
}
$outRecord[$contextKey] = $contextVal;
}
if ($foundLogOriginKeys) {
$this->formatLogOrigin($inContext, /* ref */ $outRecord);
}
}