Fix timesatmp in logs

This commit is contained in:
muzam1l
2022-03-04 15:22:05 +05:30
parent 0fe83811b9
commit bc5bb5be39
3 changed files with 5 additions and 5 deletions

View File

@@ -31,10 +31,10 @@ const DebugStream = () => {
if (typeof str !== "string") throw Error("Unrecognized debug log stream!");
const match = str.match(/([\s\S]+(?:UTC|ISO|GMT[+|-]\d+))\ ?([\s\S]*)/m);
const [_, time, msg] = match || [];
const [_, tm, msg] = match || [];
const extracted = extractJSON(msg);
const timestamp = time ? new Date(time) : undefined;
const timestamp = isNaN(Date.parse(tm || '') ) ? tm : new Date(tm).toLocaleTimeString();
const message = !extracted ? msg : msg.slice(0, extracted.start) + msg.slice(extracted.end + 1);

View File

@@ -132,7 +132,7 @@ const LogBox: FC<ILogBox> = ({ title, clearLog, logs, children, renderNav, enhan
export const Log: FC<ILog> = ({
type,
timestamp,
timestamp: timestamp,
message: _message,
link,
linkText,
@@ -181,7 +181,7 @@ export const Log: FC<ILog> = ({
activeAccountAddress={dialogAccount}
/>
<LogText variant={type}>
{timestamp && <Text muted>{timestamp.toLocaleTimeString()} </Text>}
{timestamp && <Text muted>{timestamp} </Text>}
<Pre line>{message} </Pre>
{link && (
<NextLink href={link} shallow passHref>

View File

@@ -34,7 +34,7 @@ export interface ILog {
type: "error" | "warning" | "log" | "success";
message: string;
jsonData?: any,
timestamp?: Date;
timestamp?: string;
link?: string;
linkText?: string;
defaultCollapsed?: boolean