示例#1
0
 internal void EndStageAndTransitionToStage(LogStage stage)
 {
     this.EndStage();
     if (stage == LogStage.SendResponse)
     {
         this.StartStage(stage, this.creationTime);
         return;
     }
     this.StartStage(stage);
 }
示例#2
0
 /// <summary>
 /// Writes the logs to the FilePath.
 /// </summary>
 /// <param name="e"></param>
 /// <param name="aiStage"></param>
 private void WriteLog(Exception e, LogStage aiStage)
 {
     if (aiStage >= LocalLogStage)
     {
         if (e.InnerException != null && e.StackTrace != null)
         {
             File.AppendAllText(LogPath, NowAsString + " ( " + aiStage.ToString() + " ) - Message: " + e.Message + " (Inner Exception: " + e.InnerException + " )\r\nStacktrace: " + e.StackTrace + "\r\n");
         }
         else if (e.InnerException != null)
         {
             File.AppendAllText(LogPath, NowAsString + " ( " + aiStage.ToString() + " ) - Message: " + e.Message + " (Inner Exception: " + e.InnerException + " )\r\n");
         }
         else if (e.StackTrace != null)
         {
             File.AppendAllText(LogPath, NowAsString + " ( " + aiStage.ToString() + " ) - Message: " + e.Message + "\r\nStacktrace: " + e.StackTrace + "\r\n");
         }
         else
         {
             File.AppendAllText(LogPath, NowAsString + " ( " + aiStage.ToString() + " ) - Message: " + e.Message + "\r\n");
         }
     }
 }
示例#3
0
 internal void StartStage(LogStage stage, DateTime creationTime)
 {
     this.currentStageLogEntry = new PolicyTipRequestLogger.LogEntry(stage, creationTime);
 }
示例#4
0
 internal void StartStage(LogStage stage)
 {
     this.StartStage(stage, DateTime.UtcNow);
 }
示例#5
0
 internal LogEntry(LogStage stage, DateTime creationTime)
 {
     this.Stage        = stage;
     this.creationTime = creationTime;
 }
示例#6
0
 internal LogEntry(LogStage stage) : this(stage, DateTime.UtcNow)
 {
 }
示例#7
0
 /// <summary>
 /// Logging the Exception.
 /// </summary>
 /// <param name="aiException"></param>
 /// <param name="aiStage"></param>
 public void Log(Exception aiException, LogStage aiStage)
 {
     WriteLog(aiException, aiStage);
 }
示例#8
0
 /// <summary>
 /// Logging the message.
 /// </summary>
 /// <param name="aiMessage"></param>
 /// <param name="aiStage"></param>
 public void Log(string aiMessage, LogStage aiStage)
 {
     WriteLog(new Exception(aiMessage), aiStage);
 }
示例#9
0
 public FileLogger(LogStage aiStage)
 {
     LocalLogStage = aiStage;
 }