// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The log manager. // // -------------------------------------------------------------------------------------------------------------------- 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; /// /// Tempory Class to Initialise the logging. /// public static class LogManager { /// /// The init. /// 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; } /// /// Subscribe the ErrorLogged event. /// /// /// The sender. /// /// /// The e. /// private static void HandBrakeUtils_ErrorLogged(object sender, HandBrake.ApplicationServices.Interop.EventArgs.MessageLoggedEventArgs e) { } /// /// Subscribe the MessageLogged event. /// /// /// The sender. /// /// /// The e. /// private static void HandBrakeUtils_MessageLogged(object sender, HandBrake.ApplicationServices.Interop.EventArgs.MessageLoggedEventArgs e) { } } }