public ILogger GetLogger()
{
if (!ConfigFileSource.IsEnabled)
{
return new NullLogger();
}
if (!string.IsNullOrWhiteSpace(ConfigFileSource.Logger) && ConfigFileSource.UseConsoleLogger)
{
throw new ConfigurationErrorsException(
"The UseConsoleLogger and the Logger config cannot both be filled in at the same time");
}
if (ConfigFileSource.UseConsoleLogger)
{
return new ConsoleLogger();
}
if (!string.IsNullOrWhiteSpace(ConfigFileSource.Logger))
{
Type type = Type.GetType(ConfigFileSource.Logger);
if (type != null)
{
return (ILogger)Activator.CreateInstance(type);
}
}
throw new ConfigurationErrorsException("Could not find a proper configuration");
}
}