예제 #1
0
        public static void LogMessage(string message, Issue.IssueLevel issueLevel)
        {
            try
            {
                ShowMessage(string.Format("{0}: {1}", issueLevel, message), ConsoleColor.Blue);

                switch (issueLevel)
                {
                case Issue.IssueLevel.Error:
                    ShowMessage(message, ConsoleColor.Red);
                    Trace.TraceError(message);
                    RegisterMessageAsync(message, issueLevel);
                    break;

                case Issue.IssueLevel.Warning:
                    ShowMessage(message, ConsoleColor.Yellow);
                    Trace.TraceWarning(message);
                    RegisterMessageAsync(message, issueLevel);
                    break;

                case Issue.IssueLevel.Information:
                    ShowMessage(message, ConsoleColor.Green);
                    Trace.TraceInformation(message);
                    //RegisterMessageAsync(message, issueLevel); //This will be too much and of no value to the support service.
                    break;

                default:
                    throw new ArgumentOutOfRangeException(string.Format("Unknown issuelevel {0}.", issueLevel));
                }
            }
            catch (Exception exp)
            {
                ShowMessage(exp.Message, ConsoleColor.DarkMagenta);
            }
        }
예제 #2
0
 private static void RegisterMessageEx(string message, Issue.IssueLevel issueLevel)
 {
     try
     {
         EnsureSessionEx();
         Issue.Register(message, issueLevel);
     }
     catch (Exception exp)
     {
         Trace.TraceError(string.Format("Cannot register message using tharga.support. {0}", exp.Message));
     }
 }
예제 #3
0
        private static void RegisterMessageAsync(string message, Issue.IssueLevel issueLevel)
        {
            var registerMessageTask = new Task(() => RegisterMessageEx(message, issueLevel));

            registerMessageTask.Start();
        }