blob: ec1c11ffcbb819bf7cdecabfb87b6432ebd11a20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LogManager.cs" company="HandBrake Project (http://handbrake.fr)">
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
// The log manager.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Helpers
{
using System.IO;
using HandBrake.ApplicationServices.Interop;
using HandBrakeWPF.Utilities;
using ILog = HandBrakeWPF.Services.Logging.Interfaces.ILog;
using LogService = HandBrakeWPF.Services.Logging.LogService;
/// <summary>
/// Tempory Class to Initialise the logging.
/// </summary>
public static class LogManager
{
/// <summary>
/// The init.
/// </summary>
public static void Init()
{
ILog log = LogService.GetLogger();
string logDir = DirectoryUtilities.GetLogDirectory();
string logFile = Path.Combine(logDir, string.Format("activity_log{0}.txt", GeneralUtilities.ProcessId));
if (!Directory.Exists(Path.GetDirectoryName(logFile)))
{
Directory.CreateDirectory(Path.GetDirectoryName(logFile));
}
log.Enable();
log.SetupLogHeader(GeneralUtilities.CreateLogHeader().ToString());
log.EnableLoggingToDisk(logFile, true);
HandBrakeUtils.MessageLogged += HandBrakeUtils_MessageLogged;
HandBrakeUtils.ErrorLogged += HandBrakeUtils_ErrorLogged;
}
/// <summary>
/// Subscribe the ErrorLogged event.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private static void HandBrakeUtils_ErrorLogged(object sender, HandBrake.ApplicationServices.Interop.EventArgs.MessageLoggedEventArgs e)
{
}
/// <summary>
/// Subscribe the MessageLogged event.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private static void HandBrakeUtils_MessageLogged(object sender, HandBrake.ApplicationServices.Interop.EventArgs.MessageLoggedEventArgs e)
{
}
}
}
|