Exemplo n.º 1
0
        public void AuditSuccess(string entityName, string entityKey, string eventName, ResponseBase response, int version = 1)
        {
            if (!_settings.ShouldAuditOnSuccessfulEvent)
            {
                return;
            }
            var businessEvent = new BusinessEvent(
                entityName: entityName,
                entityKey: entityKey,
                eventName: eventName,
                correlationId: response.Request?.CorrelationId,
                version: version,
                entityObject: _settings.ShouldDetailAuditOnSuccessfulEvent ? response : null);

            _logger.Info(businessEvent);
        }
Exemplo n.º 2
0
        public void AuditFailure(string entityName, string entityKey, string eventName, ResponseBase response,
                                 int version = 1)
        {
            var businessEvent = new BusinessEvent(
                entityName: entityName,
                entityKey: entityKey,
                eventName: eventName,
                correlationId: response.Request?.CorrelationId,
                version: version,
                entityObject: response);

            if (_settings.ShouldCreateExceptionForAuditing == false)
            {
                _logger.Error(businessEvent);
            }
            else
            {
                _logger.Error(CreateLoggingException(response.Errors), businessEvent);
            }
        }