Skip to content

Commit 8a52095

Browse files
committed
Extract LogLevel component and use in tooltip
1 parent 28a4699 commit 8a52095

File tree

3 files changed

+28
-33
lines changed

3 files changed

+28
-33
lines changed
Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { BookOpenIcon } from "@heroicons/react/20/solid";
2-
import { LinkButton } from "./primitives/Buttons";
31
import { Header3 } from "./primitives/Headers";
42
import { Paragraph } from "./primitives/Paragraph";
3+
import { LogLevel } from "./logs/LogLevel";
54

65
export function LogLevelTooltipInfo() {
76
return (
@@ -13,51 +12,37 @@ export function LogLevelTooltipInfo() {
1312
</Paragraph>
1413
</div>
1514
<div>
16-
<div className="mb-0.5">
17-
<Header3 className="text-blue-400">Info</Header3>
15+
<div className="mb-1">
16+
<LogLevel level="INFO" />
1817
</div>
1918
<Paragraph variant="small" className="text-text-dimmed">
2019
General informational messages about task execution.
2120
</Paragraph>
2221
</div>
2322
<div>
24-
<div className="mb-0.5">
25-
<Header3 className="text-warning">Warn</Header3>
23+
<div className="mb-1">
24+
<LogLevel level="WARN" />
2625
</div>
2726
<Paragraph variant="small" className="text-text-dimmed">
2827
Warning messages indicating potential issues that don't prevent execution.
2928
</Paragraph>
3029
</div>
3130
<div>
32-
<div className="mb-0.5">
33-
<Header3 className="text-error">Error</Header3>
31+
<div className="mb-1">
32+
<LogLevel level="ERROR" />
3433
</div>
3534
<Paragraph variant="small" className="text-text-dimmed">
3635
Error messages for failures and exceptions during task execution.
3736
</Paragraph>
3837
</div>
3938
<div>
40-
<div className="mb-0.5">
41-
<Header3 className="text-charcoal-400">Debug</Header3>
39+
<div className="mb-1">
40+
<LogLevel level="DEBUG" />
4241
</div>
4342
<Paragraph variant="small" className="text-text-dimmed">
4443
Detailed diagnostic information for development and debugging.
4544
</Paragraph>
4645
</div>
47-
<div className="border-t border-charcoal-700 pt-4">
48-
<Header3>Tracing & Spans</Header3>
49-
<Paragraph variant="small" className="text-text-dimmed">
50-
Automatically track the flow of your code through task triggers, attempts, and HTTP
51-
requests. Create custom traces to monitor specific operations.
52-
</Paragraph>
53-
</div>
54-
<LinkButton
55-
to="https://trigger.dev/docs/logging#tracing-and-spans"
56-
variant="docs/small"
57-
LeadingIcon={BookOpenIcon}
58-
>
59-
Read docs
60-
</LinkButton>
6146
</div>
6247
);
6348
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { cn } from "~/utils/cn";
2+
import { getLevelColor } from "~/utils/logUtils";
3+
import type { LogEntry } from "~/presenters/v3/LogsListPresenter.server";
4+
5+
export function LogLevel({ level }: { level: LogEntry["level"] }) {
6+
return (
7+
<span
8+
className={cn(
9+
"inline-flex items-center rounded border px-1 py-0.5 text-xxs font-medium uppercase tracking-wider",
10+
getLevelColor(level)
11+
)}
12+
>
13+
{level}
14+
</span>
15+
);
16+
}

apps/webapp/app/components/logs/LogsTable.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import { useEnvironment } from "~/hooks/useEnvironment";
77
import { useOrganization } from "~/hooks/useOrganizations";
88
import { useProject } from "~/hooks/useProject";
99
import type { LogEntry } from "~/presenters/v3/LogsListPresenter.server";
10-
import { getLevelColor, highlightSearchText } from "~/utils/logUtils";
10+
import { highlightSearchText } from "~/utils/logUtils";
1111
import { v3RunSpanPath } from "~/utils/pathBuilder";
1212
import { DateTimeAccurate } from "../primitives/DateTime";
1313
import { Paragraph } from "../primitives/Paragraph";
1414
import { Spinner } from "../primitives/Spinner";
15+
import { LogLevel } from "./LogLevel";
1516
import { TruncatedCopyableValue } from "../primitives/TruncatedCopyableValue";
1617
import { LogLevelTooltipInfo } from "~/components/LogLevelTooltipInfo";
1718
import {
@@ -169,14 +170,7 @@ export function LogsTable({
169170
<span className="font-mono text-xs">{log.taskIdentifier}</span>
170171
</TableCell>
171172
<TableCell onClick={handleRowClick} hasAction>
172-
<span
173-
className={cn(
174-
"inline-flex items-center rounded border px-1 py-0.5 text-xxs font-medium uppercase tracking-wider",
175-
getLevelColor(log.level)
176-
)}
177-
>
178-
{log.level}
179-
</span>
173+
<LogLevel level={log.level} />
180174
</TableCell>
181175
<TableCell className="max-w-0 truncate" onClick={handleRowClick} hasAction>
182176
<span className="block truncate font-mono text-xs" title={log.message}>

0 commit comments

Comments
 (0)