I'm tring to use my custom sink for serilog via app.config but with no luck. I've a class library with a TestSink class defined as
public class TestSink : ILogEventSink
{
public TestSink()
{
}
public void Emit(LogEvent logEvent)
{
}
}
In a console application I've referenced this assembly (called Test.dll) and added this
<add key="serilog:using" value="Test"/>
My program.cs is
class Program
{
static void Main(string[] args)
{
try
{
var log = new LoggerConfiguration()
.ReadFrom.AppSettings().CreateLogger();
Log.Logger = log;
Log.Information("");
}
catch (Exception ex)
{
int t = 0;
}
}
}
What I got is "Configuration system failed to initialize"
What am I doing wrong? Thanks