Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        /// <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));
        }
Ejemplo n.º 3
0
 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));
     }
 }