mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
[~] splitOut timestamp
Signed-off-by: Arthur Knoepflin <arthur@knoepflin.eu>
This commit is contained in:
parent
6dc756bad0
commit
0c121b7086
@ -87,9 +87,9 @@ export class LogList extends React.Component<Props> {
|
|||||||
return logStore.logsWithoutTimestamps;
|
return logStore.logsWithoutTimestamps;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.props.logs.map(log => (
|
return this.props.logs
|
||||||
`${moment.tz(logStore.getTimestamps(log)[0] || "", preferences.localeTimezone).format()} ${logStore.removeTimestamps(log)}`
|
.map(log => logStore.splitOutTimestamp(log))
|
||||||
));
|
.map(([logTimestamp, log]) => (`${moment.tz(logTimestamp, preferences.localeTimezone).format()} ${log}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -146,6 +146,16 @@ export class LogStore {
|
|||||||
return stamp.toISOString();
|
return stamp.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splitOutTimestamp(logs: string): [string, string] {
|
||||||
|
const extraction = /^(\d+\S+) (.*)/gm.exec(logs);
|
||||||
|
|
||||||
|
if (extraction.length < 3) {
|
||||||
|
return ["", ""];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [extraction[1], extraction[2]];
|
||||||
|
}
|
||||||
|
|
||||||
getTimestamps(logs: string) {
|
getTimestamps(logs: string) {
|
||||||
return logs.match(/^\d+\S+/gm);
|
return logs.match(/^\d+\S+/gm);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user