aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs
diff options
context:
space:
mode:
authorRoy <roy.mail.net@gmail.com>2018-02-10 02:13:37 +0200
committerRoy <roy.mail.net@gmail.com>2018-02-10 02:13:37 +0200
commit07e686eb253ffd29f36dbe530b3a17633e02b353 (patch)
treed9663f1c92a400349dffc743adb0114ee1a7f618 /Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs
parentc8c9606e545f49aae3d9f0524775436adbdf27e9 (diff)
downloadTango-07e686eb253ffd29f36dbe530b3a17633e02b353.tar.gz
Tango-07e686eb253ffd29f36dbe530b3a17633e02b353.zip
Added support for motor controllers.
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs')
-rw-r--r--Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs b/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs
new file mode 100644
index 000000000..57aea174f
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Logging
+{
+ public class SimpleStringLogger : ILogger
+ {
+ private bool _enabled;
+ private bool _immidiate;
+
+ public bool Enabled { get => _enabled; set => _enabled = value; }
+ public bool Immediate { get => _immidiate; set => _immidiate = value; }
+
+ public List<LogCategory> Categories { get; set; }
+
+ public event EventHandler<LogItemBase> LogReceived;
+
+ public SimpleStringLogger()
+ {
+ Categories = new List<LogCategory>();
+ Categories.Add(LogCategory.Critical);
+ Categories.Add(LogCategory.Debug);
+ Categories.Add(LogCategory.Error);
+ Categories.Add(LogCategory.General);
+ Categories.Add(LogCategory.Warning);
+ Enabled = true;
+ }
+
+ public SimpleStringLogger(params LogCategory[] categories)
+ {
+ Categories = categories.ToList();
+ Enabled = true;
+ }
+
+ public void OnLog(LogItemBase log)
+ {
+ if (Categories.Contains(log.Category))
+ {
+ LogReceived?.Invoke(this, log);
+ }
+ }
+ }
+}