Skip to content

Commit

Permalink
get ansi formatted content when implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordfirespeed committed Mar 3, 2024
1 parent 286af3e commit e27dec3
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ public static class LogEventArgsExtensions
{
public static LogEvent ToAvaloniaBepInExConsoleLogEvent(this LogEventArgs logEventArgs)
=> new LogEvent() {
Content = logEventArgs.ToString(),
Content = logEventArgs.GetContent(),
Level = logEventArgs.Level.ToAvaloniaBepInExConsoleLogLevel(),
SourceName = logEventArgs.Source.SourceName,
};

private static string GetContent(this LogEventArgs logEventArgs)
{
if (logEventArgs is IAnsiFormattable ansiFormattable) {
return ansiFormattable.ToAnsiFormattedString();
}

return logEventArgs.ToString();
}
}

0 comments on commit e27dec3

Please sign in to comment.