Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Commit fd23beb

Browse files
committed
feat: added trace_id in json log
1 parent 9b43e38 commit fd23beb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/DataDogFormatter.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ public function format(array $record)
4747
$record['source'] = 'php-' . php_sapi_name();
4848
$record['service'] = config('app.name');
4949
$record['hostname'] = gethostname();
50+
51+
if(extension_loaded('DDTrace')){
52+
$context = \DDTrace\current_context();
53+
$record['dd'] = [
54+
'trace_id' => $context['trace_id'],
55+
'span_id' => $context['span_id'],
56+
];
57+
}
5058

5159
return parent::format($record);
5260
}

0 commit comments

Comments
 (0)