static void Main(string[] args) { var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); ConfigLoadingContext.Load(builder, "logging.json", FileTypes.Json); var root = builder.Build(); Console.WriteLine(root["Nice"]); Console.ReadKey(); }
/// <summary> /// Initialize /// </summary> /// <param name="settingPath"></param> /// <param name="type"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static ILogServiceCollection Initialize(string settingPath, FileTypes type) { if (string.IsNullOrWhiteSpace(settingPath)) { throw new ArgumentNullException(nameof(settingPath)); } var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()); ConfigLoadingContext.Load(builder, settingPath, type); return(Initialize(builder)); }
private static void RegisterOriginalConfig(ILogServiceCollection services, string path, FileTypes fileType) { if (!string.IsNullOrWhiteSpace(path)) { services.ModifyConfigurationBuilder(b => ConfigLoadingContext.Load(b, path, fileType)); services.AddOriginalConfigAction(root => ExceptionlessClient.Default.Configuration.ReadFromConfiguration(root)); } else if (services.BeGivenConfigurationBuilder || services.BeGivenConfigurationRoot) { services.AddOriginalConfigAction(root => ExceptionlessClient.Default.Configuration.ReadFromConfiguration(root)); } }