Наследование: INotifyPropertyChanged
Пример #1
0
 /// <summary>
 /// Create new instance of Logger
 /// </summary>
 /// <param name="settings">Application settings</param>
 public BacktraceLogger(Framework.Settings settings)
 {
     if (string.IsNullOrEmpty(settings.BacktraceHost) ||
         string.IsNullOrEmpty(settings.BacktraceToken))
     {
         //there is no logger settings
         return;
     }
     LoadAttributes(settings);
     SetupClient(settings);
 }
Пример #2
0
 private void LoadAttributes(Framework.Settings settings)
 {
     foreach (var settingProperty in settings.GetType().GetProperties())
     {
         // we dont need to send information about current client settings
         if (settingProperty.Name.StartsWith("Backtrace"))
         {
             continue;
         }
         _attributes.Add(settingProperty.Name, settingProperty.GetValue(settings, null));
     }
 }
Пример #3
0
        private void SetupClient(Framework.Settings settings)
        {
            // setup new Backtrace client instance
            var credentials = new BacktraceCredentials(settings.BacktraceHost, settings.BacktraceToken);

            _client = new BacktraceClient(credentials, _attributes, settings.BacktraceDatabasePath, settings.BacktraceClientSiteLimiting);
            _client.HandleApplicationException();
            _client.AsyncRequest = true;
            _client.HandleApplicationException();
            _client.OnServerAnswer = (BacktraceServerResponse response) =>
            {
                Trace.WriteLine(response);
            };

            _client.WhenServerUnvailable = (Exception e) =>
            {
                Trace.WriteLine(e.Message);
            };
        }