aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs')
-rw-r--r--Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs14
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
}