public static void AddSessionLog(SessionLogTypeEnum sessionLogTypeEnum, string sessionId, string message, Exception exception) { var sessionLogDto = new SessionLogDto { SessionId = sessionId, LogDate = DateTime.UtcNow, Message = message, SessionLogTypeEnum = sessionLogTypeEnum }; if (exception != null) { sessionLogDto.Exception = exception.ToString(); } try { using (var context = new SqlDbContext()) { context.SessionLogs.Add(sessionLogDto); context.SaveChanges(); } } catch (Exception ex) { logger.Error(ex, $"Exception has been thrown when saving sessionLog."); return; } }
public static void AddSessionLog(SessionLogTypeEnum sourceError, string sessionId, string message) { AddSessionLog(sourceError, sessionId, message, null); }