Пример #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);
        }
 /// <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
             );
         traceSource.TraceEvent(TraceEventType.Warning, 0, $"Error while attempting to get RollbarTelemetryConfigSection:{Environment.NewLine}{ex}");
         return(null);
     }
 }
Пример #3
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(RollbarTelemetryOptions telemetryConfig)
 {
     return(AppConfigUtility.LoadAppSettings(telemetryConfig, RollbarTelemetryConfigSection.GetConfiguration()));
 }