Exemplo n.º 1
0
        protected virtual void LogInvoke <T>(InvokeResult <T> result, InvokeFunctionLogSetttings operationLogSettings)
        {
            if (result == null)
            {
                return;
            }

            switch (operationLogSettings.LogInvokeResult)
            {
            case LogInvokeResult.Always:
                _logger.Log(operationLogSettings.LogLevel, "{@result}", result);
                break;

            case LogInvokeResult.IsFail:
                if (!result.IsSuccess)
                {
                    _logger.Log(operationLogSettings.LogLevel, "{@result}", result);
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public InvokeResultSettings()
        {
            ValidationLogSettings = new OperationLogSettings
            {
                IsLogging = true,
                LogLevel  = LogLevel.Debug
            };

            LogRequestLogSettings = new OperationLogSettings
            {
                IsLogging = true,
                LogLevel  = LogLevel.Debug
            };

            InvokeFunctionLogSetttings = new InvokeFunctionLogSetttings
            {
                LogInvokeResult = LogInvokeResult.IsFail,
                LogLevel        = LogLevel.Debug
            };
        }