function Logger::emit
Overrides LoggerInterface::emit
File
-
vendor/
open-telemetry/ sdk/ Logs/ Logger.php, line 36
Class
- Logger
- Note that this logger class is deliberately NOT psr-3 compatible, per spec: "Note: this document defines a log backend API. The API is not intended to be called by application developers directly."
Namespace
OpenTelemetry\SDK\LogsCode
public function emit(LogRecord $logRecord) : void {
//If a Logger is disabled, it MUST behave equivalently to No-op Logger.
if ($this->isEnabled() === false) {
return;
}
$readWriteLogRecord = new ReadWriteLogRecord($this->scope, $this->loggerSharedState, $logRecord);
// @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#onemit
$this->loggerSharedState
->getProcessor()
->onEmit($readWriteLogRecord, $readWriteLogRecord->getContext());
if ($readWriteLogRecord->getAttributes()
->getDroppedAttributesCount()) {
self::logWarning('Dropped log attributes', [
'attributes' => $readWriteLogRecord->getAttributes()
->getDroppedAttributesCount(),
]);
}
}