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.
@@ -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 = Option.flatMap(fiberRefs.get(context, core.currentContext), Context.getOption(tracer.spanTag))
1475
- const clockService = Option.map(
1476
- fiberRefs.get(context, defaultServices.currentServices),
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" || clockService._tag === "None") {
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 = Object.fromEntries(HashMap.map(annotations, Inspectable.toStringUnknown))
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
- String(message),
1493
- clockService.value.unsafeCurrentTimeNanos(),
1498
+ Inspectable.toStringUnknown(Array.isArray(message) ? message[0] : message),
1499
+ clockService.unsafeCurrentTimeNanos(),
1494
1500
  attributes
1495
1501
  )
1496
1502
  })
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.8.2"
1
+ let moduleVersion = "3.8.3"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4