diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-02-10 13:33:02 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-02-10 13:33:02 +0200 |
| commit | 35cef16ffc96b06f68f122361ea84030169bb730 (patch) | |
| tree | 1cd239e14c8ab6733ac7225e4b39bdd282c83a9f /Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs | |
| parent | 1ae720e9052b2419200c113ad1fa42550382e6c7 (diff) | |
| download | Tango-35cef16ffc96b06f68f122361ea84030169bb730.tar.gz Tango-35cef16ffc96b06f68f122361ea84030169bb730.zip | |
Some fixes on transport layer.
Fix on machine operator upgrade firmware..
Fix on SessionFileLogger.
Fix on PPC jobs view.
Fix on Tech Catalog View.
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs | 14 |
1 files changed, 7 insertions, 7 deletions
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 /// </summary> 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 } |
