Custom Formatting
Implement IMessageFormatter to create your own formatter:
using Logix.Abstractions;
public class CsvFormatter : IMessageFormatter
{
public string Format(LogMessage msg)
{
return $"{msg.Created:O},{msg.Level},{Escape(msg.Message?.ToString())},{msg.File},{msg.Line}";
}
private static string Escape(string? s) =>
s?.Contains(',') == true ? $"\"{s}\"" : s ?? "";
}
Setting a custom formatter
Set it as the global default:
Log.Container.Logger.Formatter = new CsvFormatter();
Or on a specific sink (remote or local):
myDiscordSink.Formatter = new CsvFormatter();
myFileSink.Formatter = new CsvFormatter();
myConsoleSink.Formatter = new CsvFormatter();
All sinks (FileLogSink, ConsoleLogSink, UnityLogSink, and CloudLogSink subclasses) support a custom formatter via their Formatter property.