Exemplo n.º 1
0
        public Boolean LogException(IExceptionLog exceptionLog)
        {
            Tuple <String, String> exceptionMessages = ExceptionMessages(exceptionLog.Exception);

            TTraceLog traceLogEntity = LogTraceCore(exceptionLog.Description, exceptionLog.MethodName, exceptionLog.StatusCode);

            if (traceLogEntity != null)
            {
                ExceptionLogged exceptionLogged = new ExceptionLogged(InsertAsync(traceLogEntity, exceptionMessages.Item1, exceptionMessages.Item2), exceptionLog);
                SendEmailAsync(exceptionLogged);
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public async Task <Boolean> LogExceptionAsync(IExceptionLog exceptionLog)
        {
            Task <Tuple <String, String> > exceptionMessagesTask = new Task <Tuple <String, String> >(() => ExceptionMessages(exceptionLog.Exception));
            await exceptionMessagesTask;
            Tuple <String, String> exceptionMessages = exceptionMessagesTask.Result;

            TTraceLog traceLogEntity = LogTraceCore(exceptionLog.Description, exceptionLog.MethodName, exceptionLog.StatusCode);

            if (traceLogEntity != null)
            {
                IExceptionLogged exceptionLogged = new ExceptionLogged(InsertAsync(traceLogEntity, exceptionMessages.Item1, exceptionMessages.Item2), exceptionLog) as IExceptionLogged;
                Task             sendEmailTask   = new Task(() => { SendEmailAsync(exceptionLogged); });
                await            sendEmailTask;
                return(true);
            }
            return(false);
        }