Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-19395
Browse files Browse the repository at this point in the history
  • Loading branch information
SupaJoon committed Sep 12, 2023
2 parents 771b8d7 + 2d67b79 commit 645916b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export { useTaskStatuses } from "./useTaskStatuses";
export { useUpsertQueryParams } from "./useUpsertQueryParams";
export { useSpruceConfig } from "./useSpruceConfig";
export { useUserSettings } from "./useUserSettings";
export { useUserTimeZone } from "./useUserTimeZone";
export { useDateFormat } from "./useDateFormat";
export { useBreadcrumbRoot } from "./useBreadcrumbRoot";
export { useResize } from "./useResize";
12 changes: 9 additions & 3 deletions src/pages/task/taskTabs/logs/logTypes/LogMessageLine.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import { useMemo } from "react";
import AnsiUp from "ansi_up";
import { format } from "date-fns";
import { format, utcToZonedTime } from "date-fns-tz";
import parse from "html-react-parser";
import linkifyHtml from "linkify-html";
import { LogMessageFragment } from "gql/generated/types";
import { useUserTimeZone } from "hooks";
import { getLogLineWrapper } from "./logMessageLine/LogLines";

const FORMAT_STR = "yyyy/MM/d, HH:mm:ss.SSS";
const FORMAT_STR = "yyyy/MM/dd HH:mm:ss.SSS";
const ansiUp = new AnsiUp();

export const LogMessageLine: React.FC<LogMessageFragment> = ({
message,
severity,
timestamp,
}) => {
const time = timestamp ? `[${format(new Date(timestamp), FORMAT_STR)}] ` : "";
const tz = useUserTimeZone();
const time = timestamp
? `[${format(new Date(utcToZonedTime(timestamp, tz)), FORMAT_STR, {
timeZone: tz,
})}] `
: "";
const LogLineWrapper = getLogLineWrapper(severity);
const memoizedLogLine = useMemo(() => {
const render = linkifyHtml(ansiUp.ansi_to_html(message), {
Expand Down

0 comments on commit 645916b

Please sign in to comment.