internal void EndStageAndTransitionToStage(LogStage stage) { this.EndStage(); if (stage == LogStage.SendResponse) { this.StartStage(stage, this.creationTime); return; } this.StartStage(stage); }
/// <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"); } } }
internal void StartStage(LogStage stage, DateTime creationTime) { this.currentStageLogEntry = new PolicyTipRequestLogger.LogEntry(stage, creationTime); }
internal void StartStage(LogStage stage) { this.StartStage(stage, DateTime.UtcNow); }
internal LogEntry(LogStage stage, DateTime creationTime) { this.Stage = stage; this.creationTime = creationTime; }
internal LogEntry(LogStage stage) : this(stage, DateTime.UtcNow) { }
/// <summary> /// Logging the Exception. /// </summary> /// <param name="aiException"></param> /// <param name="aiStage"></param> public void Log(Exception aiException, LogStage aiStage) { WriteLog(aiException, aiStage); }
/// <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); }
public FileLogger(LogStage aiStage) { LocalLogStage = aiStage; }