Exemple #1
0
		//private static readonly AsyncLock Mutex = new AsyncLock ();
		public async static void AddErrorLogRecord(Exception e, DateTime timeStamp, int gymID, String methodCall, string methodParameters, String debugInfo, String stackTrace)
		{
			ErrorLog errorLog = new ErrorLog ();
			errorLog.Date = timeStamp;
			errorLog.MethodCall = methodCall;
			errorLog.MethodParamenters = methodParameters;
			errorLog.DebugInfo = debugInfo;
			errorLog.StackTrace = stackTrace;
			StaffMember staffMember = await StaffMemberDAL.GetLoggedInUser ();
			if (staffMember != null && staffMember.Id != 0) {
				errorLog.GymID = gymID == 0 ? staffMember.GymID : 0;
				errorLog.ApplicationContext = staffMember.ToString ();
			} else {
				errorLog.GymID = gymID;
				errorLog.ApplicationContext = "Login";
			}

			//Tracking errors in Xamarin Insights
			Insights.Report(e, new Dictionary<string, string>()
				{
					{"Method Name", errorLog.MethodCall},
					{"Method Parameters", errorLog.MethodParamenters},
					{"Debug Info", errorLog.DebugInfo}
				},
				Insights.Severity.Error);

			
				var db = DependencyService.Get<ISQLite> ().GetAsyncConnection ();
				await db.CreateTableAsync<ErrorLog> ();
				await db.InsertAsync (errorLog);
			
		}
Exemple #2
0
		public static ErrorLogDTO CreateErrorLogDTO(ErrorLog errorLog)
		{
			ErrorLogDTO dto = new ErrorLogDTO();
			dto.ErrorDate = errorLog.Date.ToString();
			dto.GymID = errorLog.GymID;
			dto.MethodCall = errorLog.MethodCall;
			dto.MethodParameters = errorLog.MethodParamenters;
			dto.StackTrace = errorLog.StackTrack;
			dto.DebugInfo = errorLog.DebugInfo;
			dto.ApplicationContext = errorLog.ApplicationContext;
			return dto;
		}
Exemple #3
0
		public static async Task<string> PostErrorToServer(ErrorLog errorLog)
		{
			string serviceType = "ErrorLogs";
			var errorLogDTO = ErrorLogCreator.CreateErrorLogDTO(errorLog);
			string rawJSON = JsonConvert.SerializeObject(errorLogDTO);
			var response = await BaseCoachServices.ServiceAPI.Post(serviceType, rawJSON);
			if (response == "401")
			{
				if (await TokenManager.RefreshToken())
				{
					response = await BaseCoachServices.ServiceAPI.Post(serviceType, rawJSON);
				}
			}
			return response;

		}
Exemple #4
0
		public async static void ModifyErrorLog(ErrorLog errorLog)
		{
			
				var db = DependencyService.Get<ISQLite> ().GetAsyncConnection ();
				await db.CreateTableAsync<ErrorLog> ();
				await db.UpdateAsync(errorLog);
			
		}