From 4f81c6ce6c3b836bbfdb86532199aa37382b6147 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 19 Jul 2018 13:55:25 +0300 Subject: Some improvements and fixes to machine studio logging module. --- .../ViewModels/ApplicationLogsViewVM.cs | 64 +++++++++++++++++++++- .../ViewModels/EmbeddedLogsViewVM.cs | 13 ++++- .../ViewModels/EventsViewVM.cs | 13 ++++- 3 files changed, 81 insertions(+), 9 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs index 2b12b1670..c56ca5541 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Data; using Tango.Core.Commands; using Tango.Logging; using Tango.MachineStudio.Common.Notifications; @@ -19,6 +21,8 @@ namespace Tango.MachineStudio.Logging.ViewModels private ApplicationLogFileParser _parser; private List _logFiles; private INotificationProvider _notification; + private bool _dialog_shown; + private bool _is_debug; private ControlledObservableCollection _realTimeLogs; private List _pausedLogs; @@ -30,6 +34,29 @@ namespace Tango.MachineStudio.Logging.ViewModels set { _logs = value; RaisePropertyChangedAuto(); } } + private ICollectionView _logsViewSource; + public ICollectionView LogsViewSource + { + get { return _logsViewSource; } + set { _logsViewSource = value; RaisePropertyChangedAuto(); } + } + + private String _filter; + public String Filter + { + get { return _filter; } + set + { + _filter = value; + RaisePropertyChangedAuto(); + + if (RealTimePaused) + { + LogsViewSource.Refresh(); + } + } + } + private LogItemBase _selectedLog; public LogItemBase SelectedLog { @@ -84,9 +111,19 @@ namespace Tango.MachineStudio.Logging.ViewModels if (!_realTimePaused) { + LogsViewSource.Filter = null; _realTimeLogs.InsertRange(0, _pausedLogs); _pausedLogs.Clear(); } + else + { + LogsViewSource.Filter = (x) => + { + if (String.IsNullOrWhiteSpace(Filter)) return true; + LogItemBase log = x as LogItemBase; + return log.Message.ToLower().Contains(Filter.ToLower()); + }; + } } } @@ -126,6 +163,8 @@ namespace Tango.MachineStudio.Logging.ViewModels ToggleRealTimePaused = new RelayCommand(() => RealTimePaused = !RealTimePaused); ClearRealTimeLogsCommand = new RelayCommand(() => { _realTimeLogs.Clear(); }); + + _is_debug = LogManager.Categories.Contains(LogCategory.Debug); } private void LogManager_NewLog(object sender, LogItemBase log) @@ -134,6 +173,17 @@ namespace Tango.MachineStudio.Logging.ViewModels { InvokeUI(() => { + if (_is_debug) + { + if (_realTimeLogs.Count > 1000) + { + for (int i = 998; i < _realTimeLogs.Count; i++) + { + _realTimeLogs.RemoveAt(i); + } + } + } + _realTimeLogs.Insert(0, log); }); } @@ -166,14 +216,22 @@ namespace Tango.MachineStudio.Logging.ViewModels Logs = new ControlledObservableCollection(logs); } + + LogsViewSource = CollectionViewSource.GetDefaultView(Logs); } private void OnSelectedLogChanged() { - if (SelectedLog != null) + if (SelectedLog != null && !_dialog_shown) { - _notification.ShowModalDialog(new LogDetailsViewVM(SelectedLog), (x) => { }, () => { }); - SelectedLog = null; + _dialog_shown = true; + _notification.ShowModalDialog(new LogDetailsViewVM(SelectedLog), (x) => + { + + }, () => + { + _dialog_shown = false; + }); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs index 1895dd230..3f6775b75 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs @@ -21,6 +21,7 @@ namespace Tango.MachineStudio.Logging.ViewModels private EmbeddedLogFileParser _parser; private List _logFiles; private INotificationProvider _notification; + private bool _dialog_shown; private ControlledObservableCollection _realTimeLogs; private List _pausedLogs; @@ -172,10 +173,16 @@ namespace Tango.MachineStudio.Logging.ViewModels private void OnSelectedLogChanged() { - if (SelectedLog != null) + if (SelectedLog != null && !_dialog_shown) { - _notification.ShowModalDialog(new LogDetailsViewVM(SelectedLog), (x) => { }, () => { }); - SelectedLog = null; + _dialog_shown = true; + _notification.ShowModalDialog(new LogDetailsViewVM(SelectedLog), (x) => + { + + }, () => + { + _dialog_shown = false; + }); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs index 98fcf12db..e2185bbdc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs @@ -25,6 +25,7 @@ namespace Tango.MachineStudio.Logging.ViewModels private ObservableCollection _realTimeEvents; private Machine _connectedMachine; private LoggingNavigationManager _navigation; + private bool _dialog_shown; private Machine _selectedMachine; public Machine SelectedMachine @@ -178,10 +179,16 @@ namespace Tango.MachineStudio.Logging.ViewModels private void OnSelectedEventChanged() { - if (SelectedEvent != null && SelectedEvent.Type != BL.Enumerations.EventTypes.ApplicationStarted) + if (SelectedEvent != null && SelectedEvent.Type != BL.Enumerations.EventTypes.ApplicationStarted && !_dialog_shown) { - _notification.ShowModalDialog(new EventDetailsViewVM(SelectedEvent), (x) => { }, () => { }); - SelectedEvent = null; + _dialog_shown = true; + _notification.ShowModalDialog(new EventDetailsViewVM(SelectedEvent), (x) => + { + + }, () => + { + _dialog_shown = false; + }); } } -- cgit v1.3.1 From 24a77fd5e03c81c6b0e901da02bce4bdccd4c71c Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 19 Jul 2018 14:32:56 +0300 Subject: Fixed a bug with logging module display timeline.. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../Navigation/LoggingNavigationView.cs | 2 +- .../ViewModels/EventsViewVM.cs | 2 +- .../ViewModels/TimelineEventGroup.cs | 7 ++++ .../Views/TimelineView.xaml | 41 +++++++++++---------- .../Views/TimelineView.xaml.cs | 11 ++++++ .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- 8 files changed, 42 insertions(+), 23 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 7b7040e64..968448467 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index ddc635704..f2683eab3 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Navigation/LoggingNavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Navigation/LoggingNavigationView.cs index e8a14cc3d..bd8b63773 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Navigation/LoggingNavigationView.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Navigation/LoggingNavigationView.cs @@ -10,7 +10,7 @@ namespace Tango.MachineStudio.Logging.Navigation { HomeView, EventsView, - TimelineView, + TimelineWrapperView, ApplicationLogsView, EmbeddedLogsView, } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs index e2185bbdc..50caced63 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs @@ -199,7 +199,7 @@ namespace Tango.MachineStudio.Logging.ViewModels TimelineViewVM.Initialize(events.ToList()); - _navigation.NavigateTo(LoggingNavigationView.TimelineView); + _navigation.NavigateTo(LoggingNavigationView.TimelineWrapperView); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/TimelineEventGroup.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/TimelineEventGroup.cs index 978348fd2..6a86f38e6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/TimelineEventGroup.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/TimelineEventGroup.cs @@ -13,6 +13,13 @@ namespace Tango.MachineStudio.Logging.ViewModels { public String Name { get; set; } + private double _height; + public double Height + { + get { return _height; } + set { _height = value; RaisePropertyChangedAuto(); } + } + public ObservableCollection Events { get; set; } public TimelineEventGroup() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml index 1046fa4e8..664f2489c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml @@ -68,23 +68,24 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -101,15 +102,15 @@ - + - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs index e1c09e49f..8004ef154 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs @@ -40,5 +40,16 @@ namespace Tango.MachineStudio.Logging.Views _vm.TimelineScaleFactor -= 0.5; } } + + private void ItemsControl_SizeChanged(object sender, SizeChangedEventArgs e) + { + TimelineEventGroup group = (sender as FrameworkElement).DataContext as TimelineEventGroup; + group.Height = e.NewSize.Height; + } + + private void scrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) + { + scroll_channels.ScrollToVerticalOffset(e.VerticalOffset); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index c1f1cc77d..3c8a1e91c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Wed 07/18/2018 13:18:32.22 +Thu 07/19/2018 14:26:11.83 -- cgit v1.3.1 From c4feba445987d33c7bfcc304a3be368e8458d408 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 19 Jul 2018 14:48:11 +0300 Subject: Some log improvements in TransporterBase. Added dynamic display/hide debug logs on logging module. --- .../ViewModels/ApplicationLogsViewVM.cs | 29 +++++++++++----------- .../Views/ApplicationLogsView.xaml | 10 +++++--- .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- .../Tango.Transport/TransporterBase.cs | 4 ++- 4 files changed, 25 insertions(+), 20 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs index c56ca5541..b0bc613bd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs @@ -57,6 +57,16 @@ namespace Tango.MachineStudio.Logging.ViewModels } } + private bool _displayDebug; + /// + /// Gets or sets a value indicating whether display debug logs. + /// + public bool DisplayDebug + { + get { return _displayDebug; } + set { _displayDebug = value; RaisePropertyChangedAuto(); } + } + private LogItemBase _selectedLog; public LogItemBase SelectedLog { @@ -169,21 +179,12 @@ namespace Tango.MachineStudio.Logging.ViewModels private void LogManager_NewLog(object sender, LogItemBase log) { + if (log.Category == LogCategory.Debug && !DisplayDebug) return; + if (!RealTimePaused) { InvokeUI(() => { - if (_is_debug) - { - if (_realTimeLogs.Count > 1000) - { - for (int i = 998; i < _realTimeLogs.Count; i++) - { - _realTimeLogs.RemoveAt(i); - } - } - } - _realTimeLogs.Insert(0, log); }); } @@ -225,10 +226,10 @@ namespace Tango.MachineStudio.Logging.ViewModels if (SelectedLog != null && !_dialog_shown) { _dialog_shown = true; - _notification.ShowModalDialog(new LogDetailsViewVM(SelectedLog), (x) => + _notification.ShowModalDialog(new LogDetailsViewVM(SelectedLog), (x) => { - - }, () => + + }, () => { _dialog_shown = false; }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml index 310f4fd87..eeb7204d1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/ApplicationLogsView.xaml @@ -100,10 +100,12 @@ - - - - + Process Debug Logs + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index 3c8a1e91c..625616f0e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Thu 07/19/2018 14:26:11.83 +Thu 07/19/2018 14:46:09.13 diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index dbeae5b41..6b566ab58 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -641,6 +641,8 @@ namespace Tango.Transport LogManager.Log("Parsing message container...", LogCategory.Debug); MessageContainer container = Encoder.DecodeContainer(data); + LogManager.Log("Message was identified as " + container.Type + ".", LogCategory.Debug); + if (container.Token.Length != MESSAGE_TOKEN_LENGTH) { LogManager.Log("Invalid message token length received: " + container.Token, LogCategory.Error); @@ -683,7 +685,7 @@ namespace Tango.Transport } else { - LogManager.Log("Pending request was identified as 'continuous response' " + container.Type + ". keeping pending request.", LogCategory.Debug); + LogManager.Log("Pending request was identified as 'continuous response'. keeping pending request.", LogCategory.Debug); try { -- cgit v1.3.1