From 35cef16ffc96b06f68f122361ea84030169bb730 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 10 Feb 2020 13:33:02 +0200 Subject: Some fixes on transport layer. Fix on machine operator upgrade firmware.. Fix on SessionFileLogger. Fix on PPC jobs view. Fix on Tech Catalog View. --- Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs') diff --git a/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs b/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs index 079f7f7b5..4e378bfbf 100644 --- a/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs +++ b/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs @@ -57,7 +57,7 @@ namespace Tango.Logging static SessionFileLogger() { DefaultLogsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Logs", Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName), "Session"); - + } public SessionFileLogger(String folder, String tag) @@ -82,6 +82,7 @@ namespace Tango.Logging /// public void CreateSession() { + _writeCount = 0; RemoveOldLogFile(); LogFile = CreateLogFileName(); _inInSession = true; @@ -105,17 +106,16 @@ namespace Tango.Logging { try { - if (++_writeCount > FILE_SIZE_CHECK_COUNT && new FileInfo(LogFile).Length > MaxFileSizeLimit) + if (!File.Exists(LogFile) || (++_writeCount > FILE_SIZE_CHECK_COUNT && new FileInfo(LogFile).Length > MaxFileSizeLimit)) { - _writeCount = 0; CreateSession(); - File.AppendAllText(LogFile, "### This log file is a continuation of a previous log file ###" + Environment.NewLine + Environment.NewLine); } + File.AppendAllText(LogFile, output.ToString() + Environment.NewLine); } - catch + catch (Exception ex) { - Debug.WriteLine("Error Writing To Session Log File!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + Debug.WriteLine($"Error Writing To Session Log File!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n{ex.ToString()}"); } } } @@ -160,7 +160,7 @@ namespace Tango.Logging { Debug.WriteLine(ex); } - } + } #endregion } -- cgit v1.3.1