diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-22 16:50:25 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-22 16:50:25 +0200 |
| commit | 2ebbed964bdc4aa1c2889d6c4c0521b3ba1562aa (patch) | |
| tree | 10c930342d7c137fac78c529f1c3aeb380011190 /Software/Visual_Studio | |
| parent | 5a5b63afd5c4ff1d6a1dbd6996ed0a5a494387d0 (diff) | |
| download | Tango-2ebbed964bdc4aa1c2889d6c4c0521b3ba1562aa.tar.gz Tango-2ebbed964bdc4aa1c2889d6c4c0521b3ba1562aa.zip | |
Dropped logging categories from settings on MS and PPC.
Debug Logs Processing is done in real time from UI.
Diffstat (limited to 'Software/Visual_Studio')
8 files changed, 49 insertions, 50 deletions
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 91cc677e0..a384c133d 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 @@ -59,14 +59,14 @@ namespace Tango.MachineStudio.Logging.ViewModels } } - private bool _displayDebug; + private bool _processDebugLogs; /// <summary> /// Gets or sets a value indicating whether display debug logs. /// </summary> - public bool DisplayDebug + public bool ProcessDebugLogs { - get { return _displayDebug; } - set { _displayDebug = value; RaisePropertyChangedAuto(); } + get { return _processDebugLogs; } + set { _processDebugLogs = value; RaisePropertyChangedAuto(); OnProcessDebugLogsChanged(); } } private LogItemBase _selectedLog; @@ -184,6 +184,18 @@ namespace Tango.MachineStudio.Logging.ViewModels _is_debug = LogManager.Categories.Contains(LogCategory.Debug); } + private void OnProcessDebugLogsChanged() + { + if (ProcessDebugLogs) + { + LogManager.Categories.Add(LogCategory.Debug); + } + else + { + LogManager.Categories.RemoveAll(x => x == LogCategory.Debug); + } + } + private void ApplyLogsFilter() { if ((_realTimePaused && _isRealTime) || !_isRealTime) @@ -204,8 +216,6 @@ namespace Tango.MachineStudio.Logging.ViewModels private void LogManager_NewLog(object sender, LogItemBase log) { - if (log.Category == LogCategory.Debug && !DisplayDebug) return; - if (!RealTimePaused) { InvokeUI(() => 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 4c291d0df..486c0751d 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 @@ -114,7 +114,7 @@ </StackPanel> </Border> - <CheckBox VerticalAlignment="Center" Margin="20 0 0 0" IsChecked="{Binding DisplayDebug}" IsEnabled="{Binding IsRealTime}" ToolTip="Hide/Display debug logs (applies only when debug logs are enabled in the settings file)">Process Debug Logs</CheckBox> + <CheckBox VerticalAlignment="Center" Margin="20 0 0 0" IsChecked="{Binding ProcessDebugLogs}" IsEnabled="{Binding IsRealTime}" ToolTip="Allow incoming real-time debug logs">Enable Debug Logs</CheckBox> </StackPanel> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 30 0"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 7a016b376..25dfc2dc8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -57,11 +57,6 @@ namespace Tango.MachineStudio.Common public String LastVirtualMachineSerialNumber { get; set; } /// <summary> - /// Gets or sets the logging categories. - /// </summary> - public List<LogCategory> LoggingCategories { get; set; } - - /// <summary> /// Gets or sets the last bounds. /// </summary> public Rect LastBounds { get; set; } @@ -189,7 +184,6 @@ namespace Tango.MachineStudio.Common public MachineStudioSettings() { LastBounds = new Rect(); - LoggingCategories = new List<LogCategory>(); DefaultIssueReportTags = new List<string>(); StudioModulesBounds = new List<StudioModuleBounds>(); Environment = WorkingEnvironment.Remote; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index cb17a5a83..2ea0ebd38 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -81,19 +81,6 @@ namespace Tango.MachineStudio.UI base.OnStartup(e); - LogManager.Categories.Clear(); - - - if (settings.LoggingCategories.Count == 0) - { - settings.LoggingCategories.Add(LogCategory.Critical); - settings.LoggingCategories.Add(LogCategory.Error); - settings.LoggingCategories.Add(LogCategory.Info); - settings.LoggingCategories.Add(LogCategory.Warning); - } - - LogManager.Categories.AddRange(settings.LoggingCategories); - exceptionTrapper = new WpfGlobalExceptionTrapper(); exceptionTrapper.Initialize(this); exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs index 89ac7e87b..a0110b18a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs @@ -68,6 +68,13 @@ namespace Tango.PPC.Technician.ViewModels set { _isPaused = value; RaisePropertyChangedAuto(); OnIsPausedChanged(); } } + private bool _processDebugLogs; + public bool ProcessDebugLogs + { + get { return _processDebugLogs; } + set { _processDebugLogs = value; RaisePropertyChangedAuto(); OnProcessDebugLogsChanged(); } + } + public RelayCommand ClearCommand { get; set; } public LoggingViewVM() @@ -112,6 +119,18 @@ namespace Tango.PPC.Technician.ViewModels }; } + private void OnProcessDebugLogsChanged() + { + if (ProcessDebugLogs) + { + LogManager.Categories.Add(LogCategory.Debug); + } + else + { + LogManager.Categories.RemoveAll(x => x == LogCategory.Debug); + } + } + private void OnIsPausedChanged() { foreach (var log in paused_logs) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml index 07db49909..8393349ea 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml @@ -47,6 +47,19 @@ <touch:TouchIcon Icon="Magnify" Foreground="{StaticResource TangoGrayBrush}" Width="16" Height="16" /> <touch:TouchTextBox Width="200" VerticalAlignment="Center" Margin="5 -10 0 0" Text="{Binding Filter,Delay=1000}"></touch:TouchTextBox> </StackPanel> + + <touch:TouchCheckBox IsChecked="{Binding ProcessDebugLogs}" Margin="20 0 0 0" Content="Debug Logs"> + <touch:TouchCheckBox.Style> + <Style TargetType="touch:TouchCheckBox" BasedOn="{StaticResource {x:Type touch:TouchCheckBox}}"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=nav,Path=SelectedIndex}" Value="0"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchCheckBox.Style> + </touch:TouchCheckBox> </StackPanel> </StackPanel> <touch:TouchDatePicker Visibility="Collapsed" SelectedDate="12/15/2018" Height="40" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 71a417190..2c605ec36 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -21,11 +21,6 @@ namespace Tango.PPC.Common public class PPCSettings : SettingsBase { /// <summary> - /// Gets or sets the logging categories. - /// </summary> - public List<LogCategory> LoggingCategories { get; set; } - - /// <summary> /// Gets or sets the state of the application. /// </summary> public ApplicationStates ApplicationState { get; set; } @@ -278,7 +273,6 @@ namespace Tango.PPC.Common EnableGradientGeneration = true; GradientGenerationResolution = 20; MachineScanningTimeoutSeconds = 20; - LoggingCategories = new List<LogCategory>(); EmbeddedComPort = "COM10"; EmbeddedDeviceHint = "Tango USB Serial Port"; ExternalBridgePassword = "Aa123456"; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs index 8ee8f6a1a..ff0b1018b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs @@ -69,8 +69,6 @@ namespace Tango.PPC.UI exceptionTrapper.Initialize(this); exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; - LogManager.Categories.Clear(); - CoreSettings.DefaultDataSource = new DataSource() { Address = "localhost\\SQLEXPRESS", @@ -78,22 +76,6 @@ namespace Tango.PPC.UI IntegratedSecurity = true, }; - SettingsManager.Default.GetOrCreate<CoreSettings>(); - - var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); - - if (settings.LoggingCategories.Count == 0) - { - settings.LoggingCategories.Add(LogCategory.Critical); - settings.LoggingCategories.Add(LogCategory.Error); - settings.LoggingCategories.Add(LogCategory.Info); - settings.LoggingCategories.Add(LogCategory.Warning); - } - - settings.Save(); - - LogManager.Categories.AddRange(settings.LoggingCategories); - WebRequest.DefaultWebProxy = null; } |
