diff options
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Interop')
3 files changed, 17 insertions, 11 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs index a862dc1e6..633c4e1fb 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs @@ -34,6 +34,7 @@ namespace HandBrake.ApplicationServices.Interop 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;
@@ -55,6 +56,8 @@ namespace HandBrake.ApplicationServices.Interop /// </summary>
private const double EncodePollIntervalMs = 250;
+ private readonly ILog log = LogService.GetLogger();
+
/// <summary>
/// The native handle to the HandBrake instance.
/// </summary>
@@ -502,7 +505,7 @@ namespace HandBrake.ApplicationServices.Interop {
IntPtr json = HBFunctions.hb_get_state_json(this.hbHandle);
string statusJson = Marshal.PtrToStringAnsi(json);
- LogHelper.LogMessage(new LogMessage(statusJson, LogMessageType.progressJson, LogLevel.debug));
+ this.log.LogMessage(statusJson, LogMessageType.Progress, LogLevel.Trace);
JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson);
if (state != null && state.State == NativeConstants.HB_STATE_SCANNING)
@@ -516,7 +519,7 @@ namespace HandBrake.ApplicationServices.Interop {
var jsonMsg = HBFunctions.hb_get_title_set_json(this.hbHandle);
string scanJson = InteropUtilities.ToStringFromUtf8Ptr(jsonMsg);
- LogHelper.LogMessage(new LogMessage(scanJson, LogMessageType.scanJson, LogLevel.debug));
+ this.log.LogMessage(scanJson, LogMessageType.Progress, LogLevel.Trace);
this.titles = JsonConvert.DeserializeObject<JsonScanObject>(scanJson);
this.featureTitle = this.titles.MainFeature;
@@ -541,7 +544,7 @@ namespace HandBrake.ApplicationServices.Interop IntPtr json = HBFunctions.hb_get_state_json(this.hbHandle);
string statusJson = Marshal.PtrToStringAnsi(json);
- LogHelper.LogMessage(new LogMessage(statusJson, LogMessageType.progressJson, LogLevel.debug));
+ this.log.LogMessage(statusJson, LogMessageType.Progress, LogLevel.Trace);
JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson);
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs index fcc6d61da..7e1f95d3e 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakePresetService.cs @@ -18,6 +18,7 @@ namespace HandBrake.ApplicationServices.Interop using HandBrake.ApplicationServices.Interop.Helpers;
using HandBrake.ApplicationServices.Interop.Json.Presets;
using HandBrake.ApplicationServices.Services.Logging;
+ using HandBrake.ApplicationServices.Services.Logging.Interfaces;
using HandBrake.ApplicationServices.Services.Logging.Model;
using Newtonsoft.Json;
@@ -27,6 +28,8 @@ namespace HandBrake.ApplicationServices.Interop /// </summary>
public class HandBrakePresetService
{
+ private static readonly ILog log = LogService.GetLogger();
+
/// <summary>
/// The get built in presets.
/// Requires an hb_init to have been invoked.
@@ -39,7 +42,7 @@ namespace HandBrake.ApplicationServices.Interop IntPtr presets = HBFunctions.hb_presets_builtin_get_json();
string presetJson = Marshal.PtrToStringAnsi(presets);
- LogHelper.LogMessage(new LogMessage(presetJson, LogMessageType.progressJson, LogLevel.debug));
+ log.LogMessage(presetJson, LogMessageType.API, LogLevel.Debug);
IList<PresetCategory> presetList = JsonConvert.DeserializeObject<IList<PresetCategory>>(presetJson);
@@ -60,7 +63,7 @@ namespace HandBrake.ApplicationServices.Interop IntPtr presetStringPointer = HBFunctions.hb_presets_read_file_json(InteropUtilities.ToUtf8PtrFromString(filename));
string presetJson = Marshal.PtrToStringAnsi(presetStringPointer);
- LogHelper.LogMessage(new LogMessage(presetJson, LogMessageType.libhb, LogLevel.debug));
+ log.LogMessage(presetJson, LogMessageType.API, LogLevel.Debug);
PresetTransportContainer preset = JsonConvert.DeserializeObject<PresetTransportContainer>(presetJson);
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs index 3540bb368..ef98f3f86 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs @@ -11,7 +11,6 @@ namespace HandBrake.ApplicationServices.Interop {
using System;
using System.Collections.Generic;
- using System.Diagnostics;
using System.Runtime.InteropServices;
using HandBrake.ApplicationServices.Interop.EventArgs;
@@ -19,6 +18,7 @@ namespace HandBrake.ApplicationServices.Interop 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;
@@ -28,6 +28,8 @@ namespace HandBrake.ApplicationServices.Interop /// </summary>
public static class HandBrakeUtils
{
+ private static readonly ILog log = LogService.GetLogger();
+
/// <summary>
/// The callback for log messages from HandBrake.
/// </summary>
@@ -301,7 +303,7 @@ namespace HandBrake.ApplicationServices.Interop public static Geometry GetAnamorphicSize(AnamorphicGeometry anamorphicGeometry)
{
string encode = JsonConvert.SerializeObject(anamorphicGeometry, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
- LogHelper.LogMessage(new LogMessage(encode, LogMessageType.encodeJson, LogLevel.debug));
+ log.LogMessage(encode, LogMessageType.API, LogLevel.Debug);
IntPtr json = HBFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode));
string result = Marshal.PtrToStringAnsi(json);
return JsonConvert.DeserializeObject<Geometry>(result);
@@ -317,10 +319,9 @@ namespace HandBrake.ApplicationServices.Interop {
if (MessageLogged != null)
{
+ log.LogMessage(message, LogMessageType.ScanOrEncode, LogLevel.Info);
MessageLogged(null, new MessageLoggedEventArgs(message));
}
-
- Debug.WriteLine(message);
}
/// <summary>
@@ -333,10 +334,9 @@ namespace HandBrake.ApplicationServices.Interop {
if (ErrorLogged != null)
{
+ log.LogMessage(message, LogMessageType.ScanOrEncode, LogLevel.Error);
ErrorLogged(null, new MessageLoggedEventArgs(message));
}
-
- Debug.WriteLine("ERROR: " + message);
}
}
}
|