public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { if (!IsEnabled(logLevel)) { return; } if (_config.EventId != 0 && _config.EventId != eventId.Id) { return; } var attributes = new Dictionary <string, object>(); attributes["Source"] = _name; attributes["LogLevel"] = logLevel.ToString(); attributes["Event"] = eventId; attributes["Exception"] = exception; attributes["State"] = formatter(state, exception); var eventDto = new LogEventDto { Attributes = attributes }; _processor.EnqueueEvent(eventDto); }
public virtual void EnqueueEvent(LogEventDto eventDto) { if (!_eventQueue.IsAddingCompleted) { try { _eventQueue.Add(eventDto); return; } catch (InvalidOperationException) { } } SendEvent(eventDto); }
public static LogExceptionDetailsViewModel ToDetailsException(this LogEventDto log) { return(MapperWEB.Map <LogEventDto, LogExceptionDetailsViewModel>(log)); }
public static LogViewModel ToViewModel(this LogEventDto log) { return(MapperWEB.Map <LogEventDto, LogViewModel>(log)); }
private void SendEvent(LogEventDto eventDto) { _vortexClient.SendEventAsync(eventDto); }
/// <summary> /// Logs the specified message. /// </summary> /// <param name="logEvent">The log event.</param> /// <returns></returns> public IHttpActionResult Log(LogEventDto logEvent) { _logger.Info(logEvent.Exception, logEvent.Message); return(Ok()); }
public static LogEvent ToEntity(this LogEventDto model) { return(MapperBLL.Map <LogEventDto, LogEvent>(model)); }
public void Log(LogEventDto logEvent) { _database.Logger.Log(logEvent.ToEntity()); }