aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/LogSafe.cs
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/LogSafe.cs
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/LogSafe.cs')
-rw-r--r--Software/Visual_Studio/Tango.Logging/LogSafe.cs39
1 files changed, 39 insertions, 0 deletions
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();
+ }
+ }
+}