Example #1
0
 public EmailTemplateBusinessLogic() : base(new Data.EmailTemplateData())
 {
     _EmailTemplateData = new Data.EmailTemplateData();
     _LogData           = new Data.LogData();
     _Email             = new Common.Email();
     _Email.Log        += _Email_Log;
 }
Example #2
0
 public async Task Process(Data.LogData item)
 {
     try
     {
         using (db)
         {
             db.LogDatas.Add(item);
             await db.SaveChangesAsync().ConfigureAwait(false);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
        private void Log(LogLevel level, string message, Exception exception = null, Guid?guid = null)
        {
            try
            {
                var sb = new System.Text.StringBuilder();
                if (!string.IsNullOrWhiteSpace(message))
                {
                    sb.Append(message.Trim());
                }
                if (exception != null && !string.IsNullOrWhiteSpace(exception.StackTrace))
                {
                    sb.Append(" " + exception.StackTrace);
                }
                if (guid.HasValue)
                {
                    sb.Append(" " + "[[GUID:" + guid.Value.ToString("B").ToUpper() + "]]");
                }



                var _logModel = new Data.LogData
                {
                    LogLevel = level,
                    RequestTraceIdentifier = this.RequestTraceIdentifier,
                    ClientIpAddress        = this.ClientIpAddress,
                    Message = sb.ToString(),
                    Url     = CurrentUrl
                };

                _logModel.TrimStrings();

                ScheduledJobs.FireAndForgetJobs.SaveLog(_logModel);
            }
            catch (Exception)
            {
            }
        }
Example #4
0
 public LogController()
 {
     logData    = Data.LogData.Default;
     hangarData = Data.HangarData.Default;
 }
 public static void SaveLog(Data.LogData item)
 {
     BackgroundJob.Enqueue <Managers.LogManager>(x => x.Process(item));
 }