better error display
This commit is contained in:
1 parent
3aa0120e3d
commit
6838cc54d0
3 files changed
+29
-4
No files matched your search
@@ -14,9 +14,15 @@ export function rawTime(date: string, zone: string): number {
|
||||
const cacheKey = zone + ':' + date;
|
||||
const cached = timeCache.get(cacheKey);
|
||||
if (cached !== undefined) { return cached; }
|
||||
const m = date.match(/^(\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/);
|
||||
const m = date.match(/^(?:(\d{4})-(\d\d)-(\d\d)|(\d\d)-(\d\d)-(\d\d)) (\d\d):(\d\d):(\d\d)/);
|
||||
if (!m) { return NaN; }
|
||||
const utc = Date.UTC(2000 + Number(m[3]), Number(m[2]) - 1, Number(m[1]), Number(m[4]), Number(m[5]), Number(m[6]));
|
||||
const year = Number(m[1] || (2000 + Number(m[6])));
|
||||
const month = Number(m[2] || m[5]);
|
||||
const day = Number(m[3] || m[4]);
|
||||
const hour = Number(m[7]);
|
||||
const minute = Number(m[8]);
|
||||
const second = Number(m[9]);
|
||||
const utc = Date.UTC(year, month - 1, day, hour, minute, second);
|
||||
try {
|
||||
let formatter = formatters.get(zone);
|
||||
if (!formatter) { formatter = new Intl.DateTimeFormat('en-GB', { timeZone: zone, year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hourCycle: 'h23' }); formatters.set(zone, formatter); }
|
||||
@@ -36,7 +42,7 @@ export function parseLine(line: string, file: string, offset: number, zone = 'Eu
|
||||
return { ...e, level: String(e.level || 'INFO'), kind: String(e.kind || 'log'), file, raw: line, time: Date.parse(e.timestamp) };
|
||||
} catch { return undefined; }
|
||||
}
|
||||
const m = line.match(/^(\d{2}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)?)\s+(DEBUG|INFO|WARNING|ERROR|CRITICAL)\s+([^:]+):\s?(.*)$/);
|
||||
const m = line.match(/^((?:\d{2}-\d{2}-\d{2}|\d{4}-\d{2}-\d{2}) \d{2}:\d{2}:\d{2}(?:\.\d+)?)\s+(DEBUG|INFO|WARNING|ERROR|CRITICAL)\s+([^:]+):\s?(.*)$/);
|
||||
if (!m) { return undefined; }
|
||||
const group = m[4].match(/\[group=([^\]\r\n]+):([a-f0-9]{12})\]/i);
|
||||
const id = m[4].match(/\[event=([\w-]+) trace=([\w-]+)\]/);
|
||||
|
||||
Reference in new issue
Block a user