@spunto/design-system 0.35.0 → 0.35.1
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/package.json
CHANGED
|
@@ -20,10 +20,13 @@ export interface TelemetryLogLine {
|
|
|
20
20
|
attributes?: Record<string, string>
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Tailwind text classes of a severity text: OTel's ("ERROR", "WARN", "INFO2"…) and what loggers
|
|
25
|
+
* write on their own — Python's `CRITICAL`, which OTel maps to FATAL but a store keeps as written.
|
|
26
|
+
*/
|
|
24
27
|
export function severityClass(severity: string | null | undefined): string {
|
|
25
28
|
const s = (severity ?? "").toUpperCase()
|
|
26
|
-
if (s.startsWith("ERROR") || s.startsWith("FATAL")) return "text-destructive"
|
|
29
|
+
if (s.startsWith("ERROR") || s.startsWith("FATAL") || s.startsWith("CRITICAL")) return "text-destructive"
|
|
27
30
|
if (s.startsWith("WARN")) return "text-amber-600 dark:text-amber-400"
|
|
28
31
|
return "text-muted-foreground"
|
|
29
32
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
orderSpans,
|
|
13
13
|
percentile,
|
|
14
14
|
routeOf,
|
|
15
|
+
severityClass,
|
|
15
16
|
SpanWaterfall,
|
|
16
17
|
spanTree,
|
|
17
18
|
timeBuckets,
|
|
@@ -242,3 +243,13 @@ describe("SpanWaterfall — repli", () => {
|
|
|
242
243
|
expect(screen.queryByText("agent.cmd spawn")).toBeNull()
|
|
243
244
|
})
|
|
244
245
|
})
|
|
246
|
+
|
|
247
|
+
describe("severityClass", () => {
|
|
248
|
+
it("colore en rouge ce qui est grave, quel que soit le vocabulaire du logger", () => {
|
|
249
|
+
for (const sev of ["ERROR", "error", "ERROR2", "FATAL", "CRITICAL", "critical"]) expect(severityClass(sev)).toBe("text-destructive")
|
|
250
|
+
expect(severityClass("WARN")).toContain("amber")
|
|
251
|
+
expect(severityClass("WARNING")).toContain("amber")
|
|
252
|
+
expect(severityClass("INFO")).toBe("text-muted-foreground")
|
|
253
|
+
expect(severityClass(null)).toBe("text-muted-foreground")
|
|
254
|
+
})
|
|
255
|
+
})
|