diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-22 17:12:26 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-22 17:12:26 +0200 |
| commit | 112704ab16ceb60490432bcccd897c27fd041092 (patch) | |
| tree | a86abbc94b9bc1eefed5d3d1af1127e8447b3b22 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs | |
| parent | 9950b1f4fbb94f9823d745733ac20d88fb3194ff (diff) | |
| download | Tango-112704ab16ceb60490432bcccd897c27fd041092.tar.gz Tango-112704ab16ceb60490432bcccd897c27fd041092.zip | |
Prevent machine studio from saving events to db when connected via external bridge.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs index b92c9f285..f1a205f5d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs @@ -47,6 +47,15 @@ namespace Tango.MachineStudio.Common.EventLogging #endregion + #region Properties + + /// <summary> + /// Gets or sets a value indicating whether to save the incoming events to database. + /// </summary> + public bool SaveToDB { get; set; } + + #endregion + #region Constructors /// <summary> @@ -58,6 +67,8 @@ namespace Tango.MachineStudio.Common.EventLogging { _hostName = Environment.MachineName; + SaveToDB = true; + _events = new ConcurrentQueue<MachinesEvent>(); _pendingEvents = new List<MachinesEvent>(); @@ -128,6 +139,8 @@ namespace Tango.MachineStudio.Common.EventLogging machine.RequestSent += Machine_RequestSent; machine.RequestFailed += Machine_RequestFailed; machine.ResponseReceived += Machine_ResponseReceived; + + SaveToDB = !(machine is IExternalBridgeSecureClient); } } @@ -244,7 +257,7 @@ namespace Tango.MachineStudio.Common.EventLogging machineEvent.EventType = _eventTypesGuids[eventType]; machineEvent.EventTypeGuid = machineEvent.EventType.Guid; - if (write_to_db) + if (write_to_db && SaveToDB) { Log(machineEvent); } @@ -308,6 +321,11 @@ namespace Tango.MachineStudio.Common.EventLogging /// </summary> public void FlushAll() { + if (!SaveToDB) + { + return; + } + bool _saveChanges = false; while (_events.Count > 0) |
