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!");
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user