‪Black Box
BBSensorErrorLog.cs
Go to the documentation of this file.
1 /*
2 * FILE : BBSensorErrorLogs.cs
3 * PROJECT : Black Box
4 * PROGRAMMER : BRIAN HINDS
5 * FIRST VERSION : 1.0.0.0
6 * DATE : March 20, 2019
7 * DESCRIPTION : This file manages the data logging of all errors.
8 */
9 
10 using System;
11 using System.IO;
12 
14 {
15  public class ‪BBSensorErrorLog
16  {
17  private static readonly string ‪dataPath = @"BBEL\sensorErrorLog.txt";
18 
23  public static void ‪SaveErrorData(string error)
24  {
25  if (!File.Exists(‪dataPath))
26  {
27  File.WriteAllText(‪dataPath, error + DateTime.Now.ToString("HH:mm:ss") + "," + DateTime.Now.ToString("yyyy-MM-dd") + Environment.NewLine);
28  }
29 
30  File.AppendAllText(‪dataPath, error + DateTime.Now.ToString("HH:mm:ss") + "," + DateTime.Now.ToString("yyyy-MM-dd") + Environment.NewLine);
31  }
32  }
33 }
‪static readonly string dataPath
‪static void SaveErrorData(string error)
‪Log all the error that occurs in the program