mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 13:53:40 +01:00
Display timestamp on logs
This commit is contained in:
parent
877906ae15
commit
856c198934
1 changed files with 16 additions and 4 deletions
|
|
@ -226,9 +226,12 @@ internal sealed unsafe class LoadingDialog
|
||||||
|
|
||||||
if (NewLogEntries.IsEmpty)
|
if (NewLogEntries.IsEmpty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var sb = new StringBuilder();
|
||||||
while (NewLogEntries.TryDequeue(out var e))
|
while (NewLogEntries.TryDequeue(out var e))
|
||||||
{
|
{
|
||||||
var t = e.Line.AsSpan();
|
var t = e.Line.AsSpan();
|
||||||
|
var first = true;
|
||||||
while (!t.IsEmpty)
|
while (!t.IsEmpty)
|
||||||
{
|
{
|
||||||
var i = t.IndexOfAny('\r', '\n');
|
var i = t.IndexOfAny('\r', '\n');
|
||||||
|
|
@ -237,12 +240,21 @@ internal sealed unsafe class LoadingDialog
|
||||||
if (line.IsEmpty)
|
if (line.IsEmpty)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
this.logs.Add(
|
sb.Clear();
|
||||||
line.Length < maxCharactersPerLine ? line.ToString() : $"{line[..(maxCharactersPerLine - 3)]}...");
|
if (first)
|
||||||
|
sb.Append($"{e.LogEvent.Timestamp:HH:mm:ss} | ");
|
||||||
|
else
|
||||||
|
sb.Append(" | ");
|
||||||
|
first = false;
|
||||||
|
if (line.Length < maxCharactersPerLine)
|
||||||
|
sb.Append(line);
|
||||||
|
else
|
||||||
|
sb.Append($"{line[..(maxCharactersPerLine - 3)]}...");
|
||||||
|
this.logs.Add(sb.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
sb.Clear();
|
||||||
foreach (var l in this.logs)
|
foreach (var l in this.logs)
|
||||||
sb.AppendLine(l);
|
sb.AppendLine(l);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue