effect 3.8.2 → 3.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Inspectable.js +3 -0
- package/dist/cjs/Inspectable.js.map +1 -1
- package/dist/cjs/internal/fiberRuntime.js +11 -6
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Inspectable.d.ts.map +1 -1
- package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
- package/dist/esm/Inspectable.js +3 -0
- package/dist/esm/Inspectable.js.map +1 -1
- package/dist/esm/internal/fiberRuntime.js +11 -6
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Inspectable.ts +3 -0
- package/src/internal/fiberRuntime.ts +15 -9
- package/src/internal/version.ts +1 -1
package/src/Inspectable.ts
CHANGED
|
@@ -87,6 +87,9 @@ export abstract class Class {
|
|
|
87
87
|
* @since 2.0.0
|
|
88
88
|
*/
|
|
89
89
|
export const toStringUnknown = (u: unknown, whitespace: number | string | undefined = 2): string => {
|
|
90
|
+
if (typeof u === "string") {
|
|
91
|
+
return u
|
|
92
|
+
}
|
|
90
93
|
try {
|
|
91
94
|
return typeof u === "object" ? stringifyCircular(u, whitespace) : String(u)
|
|
92
95
|
} catch (_) {
|
|
@@ -1471,26 +1471,32 @@ export const tracerLogger = globalValue(
|
|
|
1471
1471
|
logLevel,
|
|
1472
1472
|
message
|
|
1473
1473
|
}) => {
|
|
1474
|
-
const span =
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
(_) => Context.get(_, clock.clockTag)
|
|
1474
|
+
const span = Context.getOption(
|
|
1475
|
+
fiberRefs.getOrDefault(context, core.currentContext),
|
|
1476
|
+
tracer.spanTag
|
|
1478
1477
|
)
|
|
1479
|
-
if (span._tag === "None" || span.value._tag === "ExternalSpan"
|
|
1478
|
+
if (span._tag === "None" || span.value._tag === "ExternalSpan") {
|
|
1480
1479
|
return
|
|
1481
1480
|
}
|
|
1481
|
+
const clockService = Context.unsafeGet(
|
|
1482
|
+
fiberRefs.getOrDefault(context, defaultServices.currentServices),
|
|
1483
|
+
clock.clockTag
|
|
1484
|
+
)
|
|
1482
1485
|
|
|
1483
|
-
const attributes =
|
|
1486
|
+
const attributes: Record<string, unknown> = {}
|
|
1487
|
+
for (const [key, value] of annotations) {
|
|
1488
|
+
attributes[key] = value
|
|
1489
|
+
}
|
|
1484
1490
|
attributes["effect.fiberId"] = FiberId.threadName(fiberId)
|
|
1485
1491
|
attributes["effect.logLevel"] = logLevel.label
|
|
1486
1492
|
|
|
1487
1493
|
if (cause !== null && cause._tag !== "Empty") {
|
|
1488
|
-
attributes["effect.cause"] = internalCause.pretty(cause)
|
|
1494
|
+
attributes["effect.cause"] = internalCause.pretty(cause, { renderErrorCause: true })
|
|
1489
1495
|
}
|
|
1490
1496
|
|
|
1491
1497
|
span.value.event(
|
|
1492
|
-
|
|
1493
|
-
clockService.
|
|
1498
|
+
Inspectable.toStringUnknown(Array.isArray(message) ? message[0] : message),
|
|
1499
|
+
clockService.unsafeCurrentTimeNanos(),
|
|
1494
1500
|
attributes
|
|
1495
1501
|
)
|
|
1496
1502
|
})
|
package/src/internal/version.ts
CHANGED