|
1 | | -import { attributeValueToTypedAttributeValue } from '../attributes'; |
| 1 | +import { Attributes, attributeValueToTypedAttributeValue, RawAttributes, serializeAttributes } from '../attributes'; |
2 | 2 | import { getGlobalSingleton } from '../carrier'; |
3 | 3 | import type { Client } from '../client'; |
4 | 4 | import { getClient, getCurrentScope, getGlobalScope, getIsolationScope } from '../currentScopes'; |
@@ -155,25 +155,15 @@ export function _INTERNAL_captureLog( |
155 | 155 |
|
156 | 156 | const { level, message, attributes: logAttributes = {}, severityNumber } = log; |
157 | 157 |
|
158 | | - const serializedScopeAttributes = Object.fromEntries( |
159 | | - Object.entries(scopeAttributes) |
160 | | - .map(([key, value]) => [key, attributeValueToTypedAttributeValue(value)]) |
161 | | - .filter(([, value]) => value != null), |
162 | | - ); |
163 | | - |
164 | | - const serializedLogAttributes = Object.fromEntries( |
165 | | - Object.entries(logAttributes).map(([key, value]) => [key, attributeValueToTypedAttributeValue(value, true)]), |
166 | | - ); |
167 | | - |
168 | 158 | const serializedLog: SerializedLog = { |
169 | 159 | timestamp: timestampInSeconds(), |
170 | 160 | level, |
171 | 161 | body: message, |
172 | 162 | trace_id: traceContext?.trace_id, |
173 | 163 | severity_number: severityNumber ?? SEVERITY_TEXT_TO_SEVERITY_NUMBER[level], |
174 | 164 | attributes: { |
175 | | - ...serializedScopeAttributes, |
176 | | - ...serializedLogAttributes, |
| 165 | + ...serializeAttributes(scopeAttributes), |
| 166 | + ...serializeAttributes(logAttributes, true), |
177 | 167 | }, |
178 | 168 | }; |
179 | 169 |
|
|
0 commit comments