using System.ComponentModel; using System.Configuration; using Exceptron.Client.Message; namespace Exceptron.Client.Configuration { public class ExceptronConfiguration : ConfigurationSection { public ExceptronConfiguration() { Host = "http://exceptron.azurewebsites.net/api/v1/"; IncludeMachineName = true; } public static ExceptronConfiguration ReadConfig(string sectionName = "exceptron") { var configSection = ConfigurationManager.GetSection(sectionName); if (configSection == null) { throw new ConfigurationErrorsException("ExceptronConfiguration section missing."); } return (ExceptronConfiguration)configSection; } /// /// exceptron api address. Do not modify this property. /// [EditorBrowsable(EditorBrowsableState.Never)] public string Host { get; set; } /// /// If ExceptronClinet should throw exceptions in case of an error. Default: /// /// /// Its recommended that this flag is set to True during development and in production systems. /// If an exception is thrown while this flag is set to the thrown exception will be returned in /// [ConfigurationProperty("throwExceptions", DefaultValue = false)] public bool ThrowExceptions { get { return (bool)this["throwExceptions"]; } set { this["throwExceptions"] = value; } } /// /// The API of this application. Can find your API key in application settings page. /// [ConfigurationProperty("apiKey")] public string ApiKey { get { return (string)this["apiKey"]; } set { this["apiKey"] = value; } } /// /// If the machine name should be attached to the exception report /// /// Machine name can be usefull in webfarm enviroments when multiple /// servers are running the same app and the issue could be machine specific. /// Hoewever, You might want to disable this feature for privacy reasons. [ConfigurationProperty("includeMachineName", DefaultValue = true)] public bool IncludeMachineName { get { return (bool)this["includeMachineName"]; } set { this["includeMachineName"] = value; } } } }