Пример #1
0
        public static void Init()
        {
            ILog   log     = IoC.Get <ILog>();
            string logDir  = DirectoryUtilities.GetLogDirectory();
            string logFile = Path.Combine(logDir, string.Format("activity_log{0}.txt", GeneralUtilities.ProcessId));

            log.ConfigureLogging(new LogHandlerConfig(true, logFile, true, GeneralUtilities.CreateLogHeader().ToString()));
        }
Пример #2
0
        public QueueService(IEncode encodeService, IUserSettingService userSettingService, ILog logService, IErrorService errorService)
        {
            this.userSettingService = userSettingService;
            this.logService         = logService;
            this.errorService       = errorService;
            this.EncodeService      = encodeService;

            // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.
            this.queueFile = string.Format("{0}{1}.json", QueueRecoveryHelper.QueueFileName, GeneralUtilities.ProcessId);
        }
Пример #3
0
        public PrePostActionService(IQueueService queueProcessor, IUserSettingService userSettingService, IWindowManager windowManager, IScan scanService, ILog logService)
        {
            this.log = logService;
            this.userSettingService = userSettingService;
            this.windowManager      = windowManager;
            this.scanService        = scanService;

            queueProcessor.QueueCompleted       += this.QueueProcessorQueueCompleted;
            queueProcessor.QueuePaused          += this.QueueProcessor_QueuePaused;
            queueProcessor.EncodeCompleted      += this.EncodeService_EncodeCompleted;
            queueProcessor.JobProcessingStarted += this.EncodeService_EncodeStarted;
        }
Пример #4
0
        /// <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;
        }
Пример #5
0
        /// <summary>
        /// Save a copy of the log to the users desired location or a default location
        /// if this feature is enabled in options.
        /// </summary>
        /// <param name="destination">
        /// The Destination File Path
        /// </param>
        /// <param name="isPreview">
        /// The is Preview.
        /// </param>
        /// <param name="configuration">
        /// The configuration.
        /// </param>
        public string ProcessLogs(string destination, bool isPreview, HBConfiguration configuration)
        {
            try
            {
                string logDir = DirectoryUtilities.GetLogDirectory();
                string encodeDestinationPath = Path.GetDirectoryName(destination);
                string destinationFile       = Path.GetFileName(destination);
                string encodeLogFile         = destinationFile + " " + DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace("/", "-").Replace(":", "-") + ".txt";
                ILog   log        = LogService.GetLogger();
                string logContent = log.ActivityLog;

                // Make sure the log directory exists.
                if (!Directory.Exists(logDir))
                {
                    Directory.CreateDirectory(logDir);
                }

                // Copy the Log to HandBrakes log folder in the users applciation data folder.
                this.WriteFile(logContent, Path.Combine(logDir, encodeLogFile));

                // Save a copy of the log file in the same location as the enocde.
                if (configuration.SaveLogWithVideo)
                {
                    this.WriteFile(logContent, Path.Combine(encodeDestinationPath, encodeLogFile));
                }

                // Save a copy of the log file to a user specified location
                if (Directory.Exists(configuration.SaveLogCopyDirectory) && configuration.SaveLogToCopyDirectory)
                {
                    this.WriteFile(logContent, Path.Combine(configuration.SaveLogCopyDirectory, encodeLogFile));
                }

                return(Path.Combine(logDir, encodeLogFile));
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc); // This exception doesn't warrant user interaction, but it should be logged
            }

            return(null);
        }
Пример #6
0
 public LogViewModel(IErrorService errorService, ILog logService)
 {
     this.errorService = errorService;
     this.logService   = logService;
     this.Title        = Resources.LogViewModel_Title;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 public LogViewModel(IErrorService errorService)
 {
     this.errorService = errorService;
     this.logService   = LogService.GetLogger();
     this.Title        = Resources.LogViewModel_Title;
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 public LogViewModel(IErrorService errorService)
 {
     this.errorService = errorService;
     this.logService   = LogService.GetLogger();
     this.Title        = "Log Viewer";
 }
Пример #9
0
 public EncodeBase(ILog logService)
 {
     this.logService = logService;
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 public LogViewModel()
 {
     this.logService = LogService.GetLogger();
     this.Title      = "Log Viewer";
 }
Пример #11
0
 public EncodeBase(ILog logService, IUserSettingService userSettingService)
 {
     this.logService         = logService;
     this.userSettingService = userSettingService;
 }