Closed gnumoksha closed 1 year ago
Hi! Thanks for raising this Tobias. I'll look into what it should say and fix it.
This changed in monolog v2 - the code snippet here is compatible with v1.
For v2 use:
<?php
$logger->pushProcessor(function ($record) {
$context = \DDTrace\current_context();
return $record->with(message: $record['message'] . sprintf(
' [dd.trace_id=%s dd.span_id=%s]',
$context['trace_id'],
$context['span_id']
));
});
Documentation Page
Issue Description
The following snippet does not work because Monolog does not allow the processor to set the message:
That throws a
LogicException
with the messageUnsupported operation: setting message
.