private static Guid?SendBody(Body body, ErrorLevel?level, IDictionary <string, object> custom) { if (string.IsNullOrWhiteSpace(_config.AccessToken) || _config.Enabled == false) { return(null); } var guid = Guid.NewGuid(); var client = new RollbarClient(_config); var data = new Data(_config.Environment, body) { Custom = custom, Level = level ?? _config.LogLevel }; var payload = new Payload(_config.AccessToken, data); payload.Data.GuidUuid = guid; payload.Data.Person = _personFunc?.Invoke(); _config.Transform?.Invoke(payload); client.PostItem(payload); return(guid); }
private void Report(string message, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null) { using (var signal = this.CreateSignalObject()) { this._asyncLogger.Report(message, level, custom, this._timeout, signal); WaitAndCompleteReport(signal); } }
internal void Report( string message, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null, TimeSpan?timeout = null, SemaphoreSlim signal = null ) { SendAsync(new Body(new Message(message)), level, custom, timeout, signal); }
internal void Report( System.Exception e, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null, TimeSpan?timeout = null, SemaphoreSlim signal = null ) { SendBodyAsync(new Body(e), level, custom, timeout, signal); }
public async Task <Guid?> ReportAsync(Exception e, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null) { if (!IsCanSend) { return(null); } var payload = BuildPayload(new Body(e), level, custom); return(await SendBodyAsync(payload)); }
public Guid?Report(string message, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null) { if (!IsCanSend) { return(null); } var payload = BuildPayload(new Body(new Message(message)), level, custom); return(SendBody(payload)); }
static Payload BuildPayload(Body body, ErrorLevel?level, IDictionary <string, object> custom) { var data = new Data(_config.Environment, body) { Custom = custom, Level = level ?? _config.LogLevel }; var payload = new Payload(_config.AccessToken, data); payload.Data.GuidUuid = Guid.NewGuid(); payload.Data.Person = _personFunc?.Invoke(); return(payload); }
private void SendBodyAsync( Body body, ErrorLevel?level, IDictionary <string, object> custom, TimeSpan?timeout = null, SemaphoreSlim signal = null ) { DateTime?timeoutAt = null; if (timeout.HasValue) { timeoutAt = DateTime.Now.Add(timeout.Value); } // we are taking here a fire-and-forget approach: Task.Factory.StartNew(() => SendBody(body, level, custom, timeoutAt, signal)); }
public static ILiteQueryable <ErrorEntity> GetErrors(ErrorLevel?ErrorLevel = null, DateTime?StartDateTime = null, DateTime?EndDateTime = null, string ValueInMessage = null, string ValueInError = null, string ValueInStackTrace = null) { return(LiteDBHelper.Load <ErrorEntity>().Where(e => (!ErrorLevel.HasValue || (ErrorLevel.HasValue && e.ErrorLevel == ErrorLevel)) && (!StartDateTime.HasValue || (StartDateTime.HasValue && e.DateTime >= StartDateTime)) && (!EndDateTime.HasValue || (EndDateTime.HasValue && e.DateTime <= EndDateTime)) && ( (ValueInMessage == null || (ValueInMessage != null && e.Message.Contains(ValueInMessage))) || (ValueInError == null || (ValueInError != null && e.Error.Contains(ValueInError))) || (ValueInStackTrace == null || (ValueInStackTrace != null && e.StackTrace.Contains(ValueInStackTrace))) ) )); }
private void Send( Body body, ErrorLevel?level, IDictionary <string, object> custom, DateTime?timeoutAt = null, SemaphoreSlim signal = null ) { lock (this._syncRoot) { var data = new Data(this._config, body, custom); if (level.HasValue) { data.Level = level; } Send(data, timeoutAt, signal); } }
private void btnFilter_Click(object sender, RoutedEventArgs e) { ErrorLevel?enumType = null; var selectedType = logViewModel.SelectedLogType; if (cbxLogType.IsChecked.Value && selectedType != "ALL") { ErrorLevel TempenumType; if (Enum.TryParse(selectedType, out TempenumType)) { enumType = TempenumType; } } DateTime?dtFrom = null; if (cbxFrom.IsChecked.Value) { dtFrom = logViewModel.DateTimeFrom; } DateTime?dtTo = null; if (cbxTo.IsChecked.Value) { dtTo = logViewModel.DateTimeTo; } string searchText = null; if (cbxSerchText.IsChecked.Value) { searchText = logViewModel.SearchText; } LogInfo.ItemsSource = ErrorHandler.GetErrors( enumType, dtFrom, dtTo, searchText, searchText, searchText ).ToList().Take(100); }
public static Guid?Report(string message, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null) { return(SendBody(new Body(new Message(message)), level, custom)); }
public static Guid?Report(System.Exception e, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null) { return(SendBody(new Body(e), level, custom)); }
private void Report(System.Exception e, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null) { SendBodyAsync(new Body(e), level, custom); }
private void SendBody(Body body, ErrorLevel?level, IDictionary <string, object> custom) { lock (this._syncRoot) { if (string.IsNullOrWhiteSpace(this._config.AccessToken) || this._config.Enabled == false ) { return; } var data = new Data(this._config.Environment, body) { Custom = custom, Level = level ?? this._config.LogLevel }; var payload = new Payload(this._config.AccessToken, data); payload.Data.GuidUuid = Guid.NewGuid(); payload.Data.Person = this._config.Person; if (this._config.Server != null) { payload.Data.Server = this._config.Server; } try { if (this._config.CheckIgnore != null && this._config.CheckIgnore.Invoke(payload) ) { return; } } catch (System.Exception ex) { OnRollbarEvent(new InternalErrorEventArgs(this._config, payload, ex, "While check-ignoring a payload...")); } try { this._config.Transform?.Invoke(payload); } catch (System.Exception ex) { OnRollbarEvent(new InternalErrorEventArgs(this._config, payload, ex, "While transforming a payload...")); } try { this._config.Truncate?.Invoke(payload); } catch (System.Exception ex) { OnRollbarEvent(new InternalErrorEventArgs(this._config, payload, ex, "While truncating a payload...")); } this._payloadQueue.Enqueue(payload); return; } }
private void SendBodyAsync(Body body, ErrorLevel?level, IDictionary <string, object> custom) { // we are taking here a fire-and-forget approach: Task.Factory.StartNew(() => SendBody(body, level, custom)); }
private void Report(string message, ErrorLevel?level = ErrorLevel.Error, IDictionary <string, object> custom = null) { SendBodyAsync(new Body(new Message(message)), level, custom); }