Esempio n. 1
0
        /// <summary>
        /// Log a progress message.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        public void LogProgress(string value)
        {
            LogChannel.LogMessage(value, LoggingLevel.Information);

            // this.LogChannel.LogMessage(value);
            Debug.WriteLine(value);
        }
Esempio n. 2
0
        /// <summary>
        /// Any  uncaught exceptions are thrown to here
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CoreApplication_UnhandledErrorDetected(object sender, UnhandledErrorDetectedEventArgs e)
        {
            try
            {
                LogChannel.LogMessage("Caught the exception");
                e.UnhandledError.Propagate();
            }
            catch (Exception ex)
            {
                //logChannel.LogMessage(string.Format("UnhandledErro: 0x{0:X})", ex.HResult), LoggingLevel.Critical);
                LogChannel.LogMessage(string.Format("Effor Message: {0}", ex.Message));

                if (LogSession != null)
                {
                    //var filename = DateTime.Now.ToString("yyyyMMdd-HHmmssTzz") + ".etl";
                    var filename    = DateTime.Now.ToString("yyyyMMdd") + ".etl";
                    var logSaveTask = LogSession
                                      .SaveToFileAsync(logUploadFolder, filename)
                                      .AsTask();

                    logSaveTask.Wait();
                }


                // throw;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Logs the routine exit.
        /// </summary>
        /// <param name="message">
        /// The message.
        /// </param>
        public void LogRoutineExit(string message = "")
        {
            string routineName = RoutineNameStack.Pop() as string;

            LogChannel.LogMessage(routineName + "<- exit -" + message, LoggingLevel.Information);

            Debug.WriteLine(message + "<- exit -" + message);
        }
Esempio n. 4
0
        /// <summary>
        /// Log start of a routine.
        /// </summary>
        /// <param name="argRoutine">
        /// The subroutine name.
        /// </param>
        public void LogRoutineEntry(string argRoutine)
        {
            RoutineNameStack.Push(argRoutine);

            LogChannel.LogMessage(argRoutine + "-> start", LoggingLevel.Information);

            Debug.WriteLine(argRoutine + "-> start");
        }
Esempio n. 5
0
        /// <summary>
        /// Deelete the files based on the days mentioned
        /// </summary>
        public async void DeleteFile()
        {
            try
            {
                var logFiles = await logUploadFolder.GetFilesAsync();

                foreach (var logFile in logFiles)
                {
                    if ((DateTime.Now - logFile.DateCreated).Days > DAYS_TO_DELETE)
                    {
                        await logFile.DeleteAsync();
                    }
                }
            }
            catch (Exception ex)
            {
                LogChannel.LogMessage(ex.Message);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Log a variable.
        /// </summary>
        /// <param name="name">
        /// The variable name.
        /// </param>
        /// <param name="value">
        /// the value of the variable.
        /// </param>
        public void LogVariable(string name, string value)
        {
            LogChannel.LogMessage(name + " = " + value, LoggingLevel.Information);

            Debug.WriteLine(name + " = " + value);
        }