Fix timesatmp in logs
This commit is contained in:
@@ -31,10 +31,10 @@ const DebugStream = () => {
|
|||||||
if (typeof str !== "string") throw Error("Unrecognized debug log stream!");
|
if (typeof str !== "string") throw Error("Unrecognized debug log stream!");
|
||||||
|
|
||||||
const match = str.match(/([\s\S]+(?:UTC|ISO|GMT[+|-]\d+))\ ?([\s\S]*)/m);
|
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 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);
|
const message = !extracted ? msg : msg.slice(0, extracted.start) + msg.slice(extracted.end + 1);
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ const LogBox: FC<ILogBox> = ({ title, clearLog, logs, children, renderNav, enhan
|
|||||||
|
|
||||||
export const Log: FC<ILog> = ({
|
export const Log: FC<ILog> = ({
|
||||||
type,
|
type,
|
||||||
timestamp,
|
timestamp: timestamp,
|
||||||
message: _message,
|
message: _message,
|
||||||
link,
|
link,
|
||||||
linkText,
|
linkText,
|
||||||
@@ -181,7 +181,7 @@ export const Log: FC<ILog> = ({
|
|||||||
activeAccountAddress={dialogAccount}
|
activeAccountAddress={dialogAccount}
|
||||||
/>
|
/>
|
||||||
<LogText variant={type}>
|
<LogText variant={type}>
|
||||||
{timestamp && <Text muted>{timestamp.toLocaleTimeString()} </Text>}
|
{timestamp && <Text muted>{timestamp} </Text>}
|
||||||
<Pre line>{message} </Pre>
|
<Pre line>{message} </Pre>
|
||||||
{link && (
|
{link && (
|
||||||
<NextLink href={link} shallow passHref>
|
<NextLink href={link} shallow passHref>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export interface ILog {
|
|||||||
type: "error" | "warning" | "log" | "success";
|
type: "error" | "warning" | "log" | "success";
|
||||||
message: string;
|
message: string;
|
||||||
jsonData?: any,
|
jsonData?: any,
|
||||||
timestamp?: Date;
|
timestamp?: string;
|
||||||
link?: string;
|
link?: string;
|
||||||
linkText?: string;
|
linkText?: string;
|
||||||
defaultCollapsed?: boolean
|
defaultCollapsed?: boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user