示例#1
0
        /// <summary>
        /// Loads the application settings.
        /// </summary>
        /// <param name="telemetryConfig">The configuration.</param>
        /// <param name="telemetryConfigSection">The application settings.</param>
        /// <returns>false when the configuration was not found, otherwise true.</returns>
        public static bool LoadAppSettings(TelemetryConfig telemetryConfig, RollbarTelemetryConfigSection telemetryConfigSection)
        {
            if (telemetryConfigSection == null)
            {
                return(false);
            }

            if (telemetryConfigSection.TelemetryEnabled.HasValue)
            {
                telemetryConfig.TelemetryEnabled = telemetryConfigSection.TelemetryEnabled.Value;
            }
            if (telemetryConfigSection.TelemetryQueueDepth.HasValue)
            {
                telemetryConfig.TelemetryQueueDepth = telemetryConfigSection.TelemetryQueueDepth.Value;
            }
            if (telemetryConfigSection.TelemetryAutoCollectionTypes.HasValue)
            {
                telemetryConfig.TelemetryAutoCollectionTypes = telemetryConfigSection.TelemetryAutoCollectionTypes.Value;
            }
            if (telemetryConfigSection.TelemetryAutoCollectionInterval.HasValue)
            {
                telemetryConfig.TelemetryAutoCollectionInterval = telemetryConfigSection.TelemetryAutoCollectionInterval.Value;
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Gets the configuration.
        /// </summary>
        /// <returns></returns>
        public static RollbarTelemetryConfigSection GetConfiguration()
        {
            RollbarTelemetryConfigSection configuration =
                ConfigurationManager.GetSection("rollbarTelemetry") as RollbarTelemetryConfigSection;

            if (configuration != null)
            {
                return(configuration);
            }

            return(new RollbarTelemetryConfigSection());
        }
 /// <summary>
 /// Gets the configuration.
 /// </summary>
 /// <returns></returns>
 public static RollbarTelemetryConfigSection GetConfiguration()
 {
     try
     {
         RollbarTelemetryConfigSection configuration =
             ConfigurationManager.GetSection("rollbarTelemetry")
             as RollbarTelemetryConfigSection;
         return(configuration);
     }
     catch (System.Exception ex)
     {
         //let's just trace it for now:
         System.Diagnostics.Trace.TraceError(
             "Error while attempting to get RollbarTelemetryConfigSection:" + System.Environment.NewLine + ex
             );
         return(null);
     }
 }
示例#4
0
 /// <summary>
 /// Loads the application settings.
 /// </summary>
 /// <param name="telemetryConfig">The configuration.</param>
 /// <returns>false when the configuration was not found, otherwise true.</returns>
 public static bool LoadAppSettings(TelemetryConfig telemetryConfig)
 {
     return(AppConfigUtility.LoadAppSettings(telemetryConfig, RollbarTelemetryConfigSection.GetConfiguration()));
 }