From a6f3cd670f492a3474bf4695f1a8a6302fc3ed56 Mon Sep 17 00:00:00 2001 From: sr55 Date: Tue, 8 May 2018 21:31:26 +0100 Subject: [PATCH] WinGui: Remove Logging abstraction from the Services library. Let the library consumers decide how to log instead utilising the log events instead. --- .../HandBrake.ApplicationServices.csproj | 6 - .../Interop/HandBrakeInstance.cs | 3 - .../Interop/HandBrakeUtils.cs | 3 - win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 6 + win/CS/HandBrakeWPF/Helpers/LogManager.cs | 6 +- .../Services/Encode/EncodeBase.cs | 4 +- .../HandBrakeWPF/Services/Encode/LibEncode.cs | 7 +- .../Logging/EventArgs/LogEventArgs.cs | 4 +- .../Services/Logging/Interfaces/ILog.cs | 9 +- .../Services/Logging/LogService.cs | 11 +- .../Services/Logging/Model/LogLevel.cs | 84 ++++++------ .../Services/Logging/Model/LogMessage.cs | 122 +++++++++--------- .../Services/Logging/Model/LogMessageType.cs | 44 +++---- .../Services/Queue/QueueProcessor.cs | 5 +- win/CS/HandBrakeWPF/Services/Scan/LibScan.cs | 7 +- .../HandBrakeWPF/ViewModels/LogViewModel.cs | 9 +- win/CS/HandBrakeWPF/Views/LogView.xaml.cs | 3 +- 17 files changed, 167 insertions(+), 166 deletions(-) rename win/CS/{HandBrake.ApplicationServices => HandBrakeWPF}/Services/Logging/EventArgs/LogEventArgs.cs (90%) rename win/CS/{HandBrake.ApplicationServices => HandBrakeWPF}/Services/Logging/Interfaces/ILog.cs (87%) rename win/CS/{HandBrake.ApplicationServices => HandBrakeWPF}/Services/Logging/LogService.cs (97%) rename win/CS/{HandBrake.ApplicationServices => HandBrakeWPF}/Services/Logging/Model/LogLevel.cs (91%) rename win/CS/{HandBrake.ApplicationServices => HandBrakeWPF}/Services/Logging/Model/LogMessage.cs (88%) rename win/CS/{HandBrake.ApplicationServices => HandBrakeWPF}/Services/Logging/Model/LogMessageType.cs (89%) diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 79abb281c..c68770b8e 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -156,12 +156,6 @@ - - - - - - diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs index f94c6fe24..7fe52a899 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs @@ -27,9 +27,6 @@ namespace HandBrake.ApplicationServices.Interop using HandBrake.ApplicationServices.Interop.Json.State; using HandBrake.ApplicationServices.Interop.Model.Encoding; using HandBrake.ApplicationServices.Interop.Model.Preview; - using HandBrake.ApplicationServices.Services.Logging; - using HandBrake.ApplicationServices.Services.Logging.Interfaces; - using HandBrake.ApplicationServices.Services.Logging.Model; using Newtonsoft.Json; diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs index b16300fb4..a30f43133 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs @@ -17,9 +17,6 @@ namespace HandBrake.ApplicationServices.Interop using HandBrake.ApplicationServices.Interop.HbLib; using HandBrake.ApplicationServices.Interop.Json.Anamorphic; using HandBrake.ApplicationServices.Interop.Json.Shared; - using HandBrake.ApplicationServices.Services.Logging; - using HandBrake.ApplicationServices.Services.Logging.Interfaces; - using HandBrake.ApplicationServices.Services.Logging.Model; using Newtonsoft.Json; diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index cd1fdcfa2..4757f7eec 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -209,6 +209,12 @@ + + + + + + diff --git a/win/CS/HandBrakeWPF/Helpers/LogManager.cs b/win/CS/HandBrakeWPF/Helpers/LogManager.cs index 2cd94a25d..ec1c11ffc 100644 --- a/win/CS/HandBrakeWPF/Helpers/LogManager.cs +++ b/win/CS/HandBrakeWPF/Helpers/LogManager.cs @@ -9,15 +9,15 @@ namespace HandBrakeWPF.Helpers { - using System; using System.IO; using HandBrake.ApplicationServices.Interop; - using HandBrake.ApplicationServices.Services.Logging; - using HandBrake.ApplicationServices.Services.Logging.Interfaces; using HandBrakeWPF.Utilities; + using ILog = HandBrakeWPF.Services.Logging.Interfaces.ILog; + using LogService = HandBrakeWPF.Services.Logging.LogService; + /// /// Tempory Class to Initialise the logging. /// diff --git a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs index e3a807cf9..ffc33113f 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs @@ -15,8 +15,6 @@ namespace HandBrakeWPF.Services.Encode using System.IO; using HandBrake.ApplicationServices.Model; - using HandBrake.ApplicationServices.Services.Logging; - using HandBrake.ApplicationServices.Services.Logging.Interfaces; using HandBrakeWPF.Utilities; @@ -26,6 +24,8 @@ namespace HandBrakeWPF.Services.Encode using EncodeProgressEventArgs = HandBrakeWPF.Services.Encode.EventArgs.EncodeProgressEventArgs; using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask; using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException; + using ILog = HandBrakeWPF.Services.Logging.Interfaces.ILog; + using LogService = HandBrakeWPF.Services.Logging.LogService; /// /// A Base Class for the Encode Services. diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs index b6b811454..02a361ba6 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs @@ -18,9 +18,6 @@ namespace HandBrakeWPF.Services.Encode using HandBrake.ApplicationServices.Interop.Interfaces; using HandBrake.ApplicationServices.Interop.Json.State; using HandBrake.ApplicationServices.Model; - using HandBrake.ApplicationServices.Services.Logging; - using HandBrake.ApplicationServices.Services.Logging.Interfaces; - using HandBrake.ApplicationServices.Services.Logging.Model; using HandBrakeWPF.Exceptions; using HandBrakeWPF.Properties; @@ -28,6 +25,10 @@ namespace HandBrakeWPF.Services.Encode using EncodeTask = Model.EncodeTask; using IEncode = Interfaces.IEncode; + using ILog = HandBrakeWPF.Services.Logging.Interfaces.ILog; + using LogLevel = HandBrakeWPF.Services.Logging.Model.LogLevel; + using LogMessageType = HandBrakeWPF.Services.Logging.Model.LogMessageType; + using LogService = HandBrakeWPF.Services.Logging.LogService; /// /// LibHB Implementation of IEncode diff --git a/win/CS/HandBrake.ApplicationServices/Services/Logging/EventArgs/LogEventArgs.cs b/win/CS/HandBrakeWPF/Services/Logging/EventArgs/LogEventArgs.cs similarity index 90% rename from win/CS/HandBrake.ApplicationServices/Services/Logging/EventArgs/LogEventArgs.cs rename to win/CS/HandBrakeWPF/Services/Logging/EventArgs/LogEventArgs.cs index b9691e4a3..121010e31 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Logging/EventArgs/LogEventArgs.cs +++ b/win/CS/HandBrakeWPF/Services/Logging/EventArgs/LogEventArgs.cs @@ -7,11 +7,11 @@ // // -------------------------------------------------------------------------------------------------------------------- -namespace HandBrake.ApplicationServices.Services.Logging.EventArgs +namespace HandBrakeWPF.Services.Logging.EventArgs { using System; - using Model; + using LogMessage = HandBrakeWPF.Services.Logging.Model.LogMessage; /// /// The Message Logged Event Args diff --git a/win/CS/HandBrake.ApplicationServices/Services/Logging/Interfaces/ILog.cs b/win/CS/HandBrakeWPF/Services/Logging/Interfaces/ILog.cs similarity index 87% rename from win/CS/HandBrake.ApplicationServices/Services/Logging/Interfaces/ILog.cs rename to win/CS/HandBrakeWPF/Services/Logging/Interfaces/ILog.cs index dc0b3c08b..d0f5949a2 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Logging/Interfaces/ILog.cs +++ b/win/CS/HandBrakeWPF/Services/Logging/Interfaces/ILog.cs @@ -7,14 +7,15 @@ // // -------------------------------------------------------------------------------------------------------------------- -namespace HandBrake.ApplicationServices.Services.Logging.Interfaces +namespace HandBrakeWPF.Services.Logging.Interfaces { using System; using System.Collections.Generic; - using EventArgs; - - using Model; + using LogEventArgs = HandBrakeWPF.Services.Logging.EventArgs.LogEventArgs; + using LogLevel = HandBrakeWPF.Services.Logging.Model.LogLevel; + using LogMessage = HandBrakeWPF.Services.Logging.Model.LogMessage; + using LogMessageType = HandBrakeWPF.Services.Logging.Model.LogMessageType; /// /// The Log interface. diff --git a/win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs b/win/CS/HandBrakeWPF/Services/Logging/LogService.cs similarity index 97% rename from win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs rename to win/CS/HandBrakeWPF/Services/Logging/LogService.cs index 78296795c..70bea3067 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Logging/LogService.cs +++ b/win/CS/HandBrakeWPF/Services/Logging/LogService.cs @@ -10,7 +10,7 @@ // // -------------------------------------------------------------------------------------------------------------------- -namespace HandBrake.ApplicationServices.Services.Logging +namespace HandBrakeWPF.Services.Logging { using System; using System.Collections.Generic; @@ -21,9 +21,12 @@ namespace HandBrake.ApplicationServices.Services.Logging using HandBrake.ApplicationServices.Interop; using HandBrake.ApplicationServices.Interop.EventArgs; - using HandBrake.ApplicationServices.Services.Logging.EventArgs; - using HandBrake.ApplicationServices.Services.Logging.Interfaces; - using HandBrake.ApplicationServices.Services.Logging.Model; + + using ILog = Interfaces.ILog; + using LogEventArgs = EventArgs.LogEventArgs; + using LogLevel = Model.LogLevel; + using LogMessage = Model.LogMessage; + using LogMessageType = Model.LogMessageType; /// /// The log helper. diff --git a/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogLevel.cs b/win/CS/HandBrakeWPF/Services/Logging/Model/LogLevel.cs similarity index 91% rename from win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogLevel.cs rename to win/CS/HandBrakeWPF/Services/Logging/Model/LogLevel.cs index a319ae385..07f35e304 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogLevel.cs +++ b/win/CS/HandBrakeWPF/Services/Logging/Model/LogLevel.cs @@ -1,42 +1,42 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// The log level. -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.ApplicationServices.Services.Logging.Model -{ - /// - /// The log level. - /// - public enum LogLevel - { - /// - /// The info. - /// - Info, - - /// - /// The warning. - /// - Warning, - - /// - /// The error. - /// - Error, - - /// - /// The debug. - /// - Debug, - - /// - /// Trace Level Logging. - /// - Trace, - } -} +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The log level. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Services.Logging.Model +{ + /// + /// The log level. + /// + public enum LogLevel + { + /// + /// The info. + /// + Info, + + /// + /// The warning. + /// + Warning, + + /// + /// The error. + /// + Error, + + /// + /// The debug. + /// + Debug, + + /// + /// Trace Level Logging. + /// + Trace, + } +} diff --git a/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessage.cs b/win/CS/HandBrakeWPF/Services/Logging/Model/LogMessage.cs similarity index 88% rename from win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessage.cs rename to win/CS/HandBrakeWPF/Services/Logging/Model/LogMessage.cs index edf071ba1..7fa98d1d2 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessage.cs +++ b/win/CS/HandBrakeWPF/Services/Logging/Model/LogMessage.cs @@ -1,61 +1,61 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// The message. -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.ApplicationServices.Services.Logging.Model -{ - /// - /// An Immutable Log Entry. - /// - public class LogMessage - { - /// - /// Initializes a new instance of the class. - /// - /// - /// The content. - /// - /// - /// The message type. - /// - /// - /// The log level. - /// - /// - /// The message Index. - /// - public LogMessage(string content, LogMessageType messageType, LogLevel logLevel, long messageIndex) - { - this.Content = content; - this.MessageType = messageType; - this.LogLevel = logLevel; - this.MessageIndex = messageIndex; - } - - /// - /// Gets the content. - /// - public string Content { get; private set; } - - /// - /// Gets a value indicating whether this message was generated by the GUI. - /// If false, it was provided by libhb. - /// - public LogMessageType MessageType { get; private set; } - - /// - /// Gets the log level. - /// - public LogLevel LogLevel { get; private set; } - - /// - /// Gets the message index. - /// - public long MessageIndex { get; private set; } - } -} +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The message. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Services.Logging.Model +{ + /// + /// An Immutable Log Entry. + /// + public class LogMessage + { + /// + /// Initializes a new instance of the class. + /// + /// + /// The content. + /// + /// + /// The message type. + /// + /// + /// The log level. + /// + /// + /// The message Index. + /// + public LogMessage(string content, LogMessageType messageType, LogLevel logLevel, long messageIndex) + { + this.Content = content; + this.MessageType = messageType; + this.LogLevel = logLevel; + this.MessageIndex = messageIndex; + } + + /// + /// Gets the content. + /// + public string Content { get; private set; } + + /// + /// Gets a value indicating whether this message was generated by the GUI. + /// If false, it was provided by libhb. + /// + public HandBrakeWPF.Services.Logging.Model.LogMessageType MessageType { get; private set; } + + /// + /// Gets the log level. + /// + public HandBrakeWPF.Services.Logging.Model.LogLevel LogLevel { get; private set; } + + /// + /// Gets the message index. + /// + public long MessageIndex { get; private set; } + } +} diff --git a/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs b/win/CS/HandBrakeWPF/Services/Logging/Model/LogMessageType.cs similarity index 89% rename from win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs rename to win/CS/HandBrakeWPF/Services/Logging/Model/LogMessageType.cs index dfa467b4a..7c50267fb 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Logging/Model/LogMessageType.cs +++ b/win/CS/HandBrakeWPF/Services/Logging/Model/LogMessageType.cs @@ -1,22 +1,22 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// The log message type. -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.ApplicationServices.Services.Logging.Model -{ - /// - /// The log message type. - /// - public enum LogMessageType - { - ScanOrEncode, - API, - Progress, - Application, - } -} +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The log message type. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Services.Logging.Model +{ + /// + /// The log message type. + /// + public enum LogMessageType + { + ScanOrEncode, + API, + Progress, + Application, + } +} diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs index 098e9201a..9cf9b1320 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs @@ -17,8 +17,6 @@ namespace HandBrakeWPF.Services.Queue using System.Xml.Serialization; using HandBrake.ApplicationServices.Model; - using HandBrake.ApplicationServices.Services.Logging; - using HandBrake.ApplicationServices.Services.Logging.Model; using HandBrake.ApplicationServices.Utilities; using HandBrakeWPF.Factories; @@ -33,6 +31,9 @@ namespace HandBrakeWPF.Services.Queue using Execute = Caliburn.Micro.Execute; using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException; using IEncode = HandBrakeWPF.Services.Encode.Interfaces.IEncode; + using LogLevel = HandBrakeWPF.Services.Logging.Model.LogLevel; + using LogMessageType = HandBrakeWPF.Services.Logging.Model.LogMessageType; + using LogService = HandBrakeWPF.Services.Logging.LogService; using QueueCompletedEventArgs = HandBrakeWPF.EventArgs.QueueCompletedEventArgs; using QueueProgressEventArgs = HandBrakeWPF.EventArgs.QueueProgressEventArgs; diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index bb2703903..14b13d2e4 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -22,9 +22,6 @@ namespace HandBrakeWPF.Services.Scan using HandBrake.ApplicationServices.Interop.Model.Encoding; using HandBrake.ApplicationServices.Interop.Model.Preview; using HandBrake.ApplicationServices.Model; - using HandBrake.ApplicationServices.Services.Logging; - using HandBrake.ApplicationServices.Services.Logging.Interfaces; - using HandBrake.ApplicationServices.Services.Logging.Model; using HandBrakeWPF.Services.Encode.Model; using HandBrakeWPF.Services.Encode.Model.Models; @@ -34,6 +31,10 @@ namespace HandBrakeWPF.Services.Scan using HandBrakeWPF.Utilities; using Chapter = HandBrakeWPF.Services.Scan.Model.Chapter; + using ILog = HandBrakeWPF.Services.Logging.Interfaces.ILog; + using LogLevel = HandBrakeWPF.Services.Logging.Model.LogLevel; + using LogMessageType = HandBrakeWPF.Services.Logging.Model.LogMessageType; + using LogService = HandBrakeWPF.Services.Logging.LogService; using ScanProgressEventArgs = HandBrake.ApplicationServices.Interop.EventArgs.ScanProgressEventArgs; using Subtitle = HandBrakeWPF.Services.Scan.Model.Subtitle; using Title = HandBrakeWPF.Services.Scan.Model.Title; diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs index 3fcb4c96c..6573b1f5a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs @@ -16,14 +16,13 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro; - using HandBrake.ApplicationServices.Services.Logging; - using HandBrake.ApplicationServices.Services.Logging.EventArgs; - using HandBrake.ApplicationServices.Services.Logging.Model; - using HandBrakeWPF.Utilities; using HandBrakeWPF.ViewModels.Interfaces; - using ILog = HandBrake.ApplicationServices.Services.Logging.Interfaces.ILog; + using ILog = HandBrakeWPF.Services.Logging.Interfaces.ILog; + using LogEventArgs = HandBrakeWPF.Services.Logging.EventArgs.LogEventArgs; + using LogMessage = HandBrakeWPF.Services.Logging.Model.LogMessage; + using LogService = HandBrakeWPF.Services.Logging.LogService; /// /// The Log View Model diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml.cs b/win/CS/HandBrakeWPF/Views/LogView.xaml.cs index 67d2f21df..096032a04 100644 --- a/win/CS/HandBrakeWPF/Views/LogView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/LogView.xaml.cs @@ -14,6 +14,7 @@ namespace HandBrakeWPF.Views using System.Windows; using System.Windows.Controls; + using HandBrakeWPF.Services.Logging.EventArgs; using HandBrakeWPF.ViewModels; /// @@ -58,7 +59,7 @@ namespace HandBrakeWPF.Views /// /// The e. /// - private void Vm_LogMessageReceived(object sender, HandBrake.ApplicationServices.Services.Logging.EventArgs.LogEventArgs e) + private void Vm_LogMessageReceived(object sender, LogEventArgs e) { try { -- 2.40.0