mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-01 05:13: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)
|
||||
return;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
while (NewLogEntries.TryDequeue(out var e))
|
||||
{
|
||||
var t = e.Line.AsSpan();
|
||||
var first = true;
|
||||
while (!t.IsEmpty)
|
||||
{
|
||||
var i = t.IndexOfAny('\r', '\n');
|
||||
|
|
@ -236,13 +239,22 @@ internal sealed unsafe class LoadingDialog
|
|||
t = i == -1 ? ReadOnlySpan<char>.Empty : t[(i + 1)..];
|
||||
if (line.IsEmpty)
|
||||
continue;
|
||||
|
||||
this.logs.Add(
|
||||
line.Length < maxCharactersPerLine ? line.ToString() : $"{line[..(maxCharactersPerLine - 3)]}...");
|
||||
|
||||
sb.Clear();
|
||||
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)
|
||||
sb.AppendLine(l);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue