aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-14 19:45:44 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-14 19:45:44 +0300
commit9d5f73560e6629634965291f7fe2895fa59e34ab (patch)
tree131d6cdc6b17aab85a16ff30da936ba5d3953b21 /Software/Visual_Studio/Tango.Logging
parentdc519b8dbd294a2a956f051bca63a30eb9c07986 (diff)
downloadTango-9d5f73560e6629634965291f7fe2895fa59e34ab.tar.gz
Tango-9d5f73560e6629634965291f7fe2895fa59e34ab.zip
Added application start logs viewing to FSE & PPC using LogSafe.
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging')
-rw-r--r--Software/Visual_Studio/Tango.Logging/LogManager.cs9
-rw-r--r--Software/Visual_Studio/Tango.Logging/LogSafe.cs39
-rw-r--r--Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj3
3 files changed, 50 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.Logging/LogManager.cs b/Software/Visual_Studio/Tango.Logging/LogManager.cs
index 55264164a..4148fa342 100644
--- a/Software/Visual_Studio/Tango.Logging/LogManager.cs
+++ b/Software/Visual_Studio/Tango.Logging/LogManager.cs
@@ -259,5 +259,14 @@ namespace Tango.Logging
NewLog?.Invoke(this, log);
}
}
+
+ /// <summary>
+ /// Creates a new log safe which can be used to keep logs and then be disposed.
+ /// </summary>
+ /// <returns></returns>
+ public LogSafe CreateLogSafe()
+ {
+ return new LogSafe(this);
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.Logging/LogSafe.cs b/Software/Visual_Studio/Tango.Logging/LogSafe.cs
new file mode 100644
index 000000000..2da51e90c
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Logging/LogSafe.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Logging
+{
+ public class LogSafe : IDisposable
+ {
+ private LogManager _logManager;
+ private List<LogItemBase> Logs { get; set; }
+
+ public LogSafe(LogManager logManager)
+ {
+ _logManager = logManager;
+ Logs = new List<LogItemBase>();
+ logManager.NewLog += LogManager_NewLog;
+ }
+
+ private void LogManager_NewLog(object sender, LogItemBase log)
+ {
+ Logs.Add(log);
+ }
+
+ public List<LogItemBase> EmptyAndDispose()
+ {
+ var list = Logs.ToList();
+ Dispose();
+ return list;
+ }
+
+ public void Dispose()
+ {
+ _logManager.NewLog -= LogManager_NewLog;
+ Logs.Clear();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj b/Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj
index e2e2b1edd..d9a2e1139 100644
--- a/Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj
+++ b/Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj
@@ -63,6 +63,7 @@
<Compile Include="LogCategory.cs" />
<Compile Include="LogItemBase.cs" />
<Compile Include="LogManager.cs" />
+ <Compile Include="LogSafe.cs" />
<Compile Include="MessageLogItem.cs" />
<Compile Include="ApplicationLogFileParser.cs" />
<Compile Include="ILogFileParser.cs" />
@@ -82,7 +83,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file