Пример #1
0
        /// <summary>
        /// Sets the model image.
        /// </summary>
        /// <param name="severity">The severity.</param>
        private void SetModelImage(MessageSeverity severity)
        {
            BitmapImage img = new BitmapImage();

            img.BeginInit();
            switch (severity)
            {
            case MessageSeverity.Caution:
                img.StreamSource = Application.GetResourceStream(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/ledred.png"))?.Stream;
                break;

            case MessageSeverity.Success:
                img.StreamSource = Application.GetResourceStream(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/ledlightblue.png"))?.Stream;
                break;
            }

            img.EndInit();
            img.Freeze();
            Dispatcher.CurrentDispatcher.Invoke(() => this.StatusImage = img);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of <see cref="MessageBase"/> class with given
 /// severity, source and time.
 /// </summary>
 /// <param name="severity">Message severity.</param>
 /// <param name="source">Message source.</param>
 /// <param name="time">Message time.</param>
 protected MessageBase(MessageSeverity severity, string source, DateTime time) :
     this()
 {
     this.severity = severity;
     this.source = source;
     this.time = time;
 }
Пример #3
0
        /// <summary>Adds a message for the competition.</summary>
        /// <param name="messageSource">Source of the message.</param>
        /// <param name="messageSeverity">Severity of the message.</param>
        /// <param name="message">Text of the message.</param>
        /// <param name="hint">Hints for the message.</param>
        internal void WriteMessageCore(
            MessageSource messageSource, MessageSeverity messageSeverity,
            [NotNull] string message,
            [CanBeNull] string hint = null)
        {
            Message result;

            lock (_lockKey)
            {
                AssertIsInCompetition();

                result = new Message(
                    RunNumber, MessagesInRun + 1,
                    Elapsed,
                    messageSource, messageSeverity,
                    message, hint);

                _messages.Add(result);
                MessagesInRun++;

                if (HighestMessageSeverityInRun < messageSeverity)
                {
                    HighestMessageSeverityInRun = messageSeverity;
                }
                if (HighestMessageSeverity < messageSeverity)
                {
                    HighestMessageSeverity = messageSeverity;
                }
            }

            Logger.LogMessage(result);
        }
Пример #4
0
        public void AddApplicationMessage(string message, MessageSeverity severity)
        {
            List <AppMessage> messages = TempData["AppMessages"] as List <AppMessage> ?? new List <AppMessage>();

            messages.Add(new AppMessage(message, severity));
            TempData["AppMessages"] = messages;
        }
Пример #5
0
		/// <summary>
		/// Log a message to all loggers enabled for this type of message.
		/// </summary>
		/// <param name="Message"></param>
		/// <param name="Type"></param>
		/// <param name="Severity"></param>
		public void RecordMessage(string Message, MessageType Type, MessageSeverity Severity)
		{	if (!mEnableLogging)
				return;

			switch (Type)
			{
				case MessageType.Exception:
					foreach (ApiLogger logger in mApiLoggerList)
					{
						if (logger.LogExceptions)
							logger.RecordMessage(Message, Severity);
					}

					break;
				case MessageType.Information:
					foreach (ApiLogger logger in mApiLoggerList)
					{
						if (logger.LogInformations)
							logger.RecordMessage(Message, Severity);
					}

					break;

				case MessageType.ApiMessage:
					foreach (ApiLogger logger in mApiLoggerList)
					{
						if (logger.LogApiMessages)
							logger.RecordMessage(Message, Severity);
					}
				
					break;

			}
		}
        public void PrintToScreen(string message, string caption, MessageSeverity severity)
        {
            MessageBoxIcon icon;

            switch (severity)
            {
            case MessageSeverity.Information:
                icon = MessageBoxIcon.Information;
                break;

            case MessageSeverity.Warning:
                icon = MessageBoxIcon.Warning;
                break;

            case MessageSeverity.Error:
                icon = MessageBoxIcon.Error;
                break;

            case MessageSeverity.None:
            default:
                icon = MessageBoxIcon.None;
                break;
            }

            MessageBox.Show(message, caption, MessageBoxButtons.OK, icon);
        }
 public void Report(MessageSeverity severity, string message)
 {
     foreach (var item in this)
     {
         item.Report(severity, message);
     }
 }
Пример #8
0
 public CompileMessage(string message, string errorCode, MessageSeverity severity, string filename, long startIndex, uint startLine, long length)
 {
     this.Message   = message;
     this.ErrorCode = errorCode;
     this.Severity  = severity;
     this.Span      = new SourceSpan(filename, startIndex, startLine, length);
 }
Пример #9
0
 public CompileMessage(string message, string errorCode, MessageSeverity severity, SourceSpan span)
 {
     this.Message   = message;
     this.ErrorCode = errorCode;
     this.Severity  = severity;
     this.Span      = span;
 }
Пример #10
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="Message"></param>
		/// <param name="Severity"></param>
		public override void RecordMessage(string Message, MessageSeverity Severity)
		{
			FileStream fileStream = null;
			StreamWriter writer = null;
			StringBuilder message = new StringBuilder();

 
			// Create the message
			message.Append("["+DateTime.Now.ToString(System.Globalization.CultureInfo.CurrentUICulture));
			message.Append(", " + Severity.ToString());
			message.Append("]\r\n" + Message + "\r\n");

			lock(this) 
			{
				string filePath = getAbsoluteFilePath();
				fileStream = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write);
				using (writer = new StreamWriter(fileStream))
				{
					// Set the file pointer to the end of the file
					writer.BaseStream.Seek(0, SeekOrigin.End); 
				
					// Force the write to the underlying file
					writer.WriteLine(message.ToString());
					writer.Flush();
					if( writer != null ) writer.Close();
				}
			}
		}
Пример #11
0
        /// <summary>
        /// Adds the message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="severity">The severity.</param>
        public void AddMessage(string message, MessageSeverity severity = MessageSeverity.Info)
        {
            var messageEntity = messageService.CreateMessage(message, instance, severity);

            messageService.SaveMessage(messageEntity);
            instance.Messages.Add(messageEntity);
        }
Пример #12
0
 public void Log(MessageSeverity severity, string msg)
 {
     m_msgs.Add(new ParserMessage()
     {
         Severity = severity, Message = msg, LineNum = m_context.LineNum, LineCol = m_context.LineCol
     });
 }
Пример #13
0
        public void ShowMessage(string message, MessageSeverity severity)
        {
            this.MaintainScrollPositionOnPostBack = false;
            Panel messagePanel = FindMessagePanelControl();
            Label messageLabel = FindMessageLabelControl();

            switch (severity)
            {
            case MessageSeverity.Critical:
            case MessageSeverity.Error:
                this.AddScript("document.getElementById('" + messagePanel.ClientID +
                               "').className = 'messageError';");
                break;

            case MessageSeverity.Warning:
            case MessageSeverity.Debug:
                this.AddScript("document.getElementById('" + messagePanel.ClientID +
                               "').className = 'messageWarning';");
                break;

            case MessageSeverity.Confirmation:
            case MessageSeverity.Information:
                this.AddScript("document.getElementById('" + messagePanel.ClientID +
                               "').className = 'messageInfo';");
                break;

            default:
                this.AddScript("document.getElementById('" + messagePanel.ClientID +
                               "').className = 'messageError';");
                break;
            }
            this.AddScript("document.getElementById('" + messagePanel.ClientID +
                           "').style.display = '';document.getElementById('" + messageLabel.ClientID +
                           "').innerHTML = '" + message + "';document.body.scrollTop = 0;");
        }
Пример #14
0
        private void AddError(IList <IErrorListItem> errors, string file, int line, int column, int length, string errCode, string message,
                              string projectName, MessageSeverity sev, ErrorSource errorSource)
        {
            var item = new ErrorListItem()
            {
                Filename    = file,
                Line        = line,
                Column      = column,
                Length      = length,
                ErrorCode   = errCode,
                Message     = message,
                ProjectName = projectName,
                ErrorSource = errorSource,
                Severity    = sev,
                BuildTool   = errorSource == ErrorSource.Build ? "Build" : "Live",
                ProjectGuid = Project.ProjectIDGuid
                              //Manager = this
            };

            lock (this)
            {
                errors.Add(item);
                dirty = true;
            }
        }
Пример #15
0
 public static bool CheckDisplayMessage(MessageSeverity messageSeverity, MessageSeverity userSeverityLevel)
 {
     if (messageSeverity == MessageSeverity.Always)
     {
         return(true);
     }
     else if (messageSeverity == MessageSeverity.Error)
     {
         return(true);
     }
     else if (messageSeverity == MessageSeverity.Warning)
     {
         return(userSeverityLevel == MessageSeverity.Warning || userSeverityLevel == MessageSeverity.Success || userSeverityLevel == MessageSeverity.Debug);
     }
     else if (messageSeverity == MessageSeverity.Success)
     {
         return(userSeverityLevel == MessageSeverity.Success || userSeverityLevel == MessageSeverity.Debug);
     }
     else if (messageSeverity == MessageSeverity.Debug)
     {
         return(userSeverityLevel == MessageSeverity.Debug);
     }
     else
     {
         return(false);
     }
 }
Пример #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Message"></param>
        /// <param name="Severity"></param>
        public override void RecordMessage(string Message, MessageSeverity Severity)
        {
            FileStream    fileStream = null;
            StreamWriter  writer     = null;
            StringBuilder message    = new StringBuilder();


            // Create the message
            message.Append("[" + DateTime.Now.ToString(System.Globalization.CultureInfo.CurrentUICulture));
            message.Append(", " + Severity.ToString());
            message.Append("]\r\n" + Message + "\r\n");

            lock (this)
            {
                string filePath = getAbsoluteFilePath();
                fileStream = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write);
                using (writer = new StreamWriter(fileStream))
                {
                    // Set the file pointer to the end of the file
                    writer.BaseStream.Seek(0, SeekOrigin.End);

                    // Force the write to the underlying file
                    writer.WriteLine(message.ToString());
                    writer.Flush();
                    if (writer != null)
                    {
                        writer.Close();
                    }
                }
            }
        }
Пример #17
0
 /// <summary>
 /// Reports a message to the build environment.
 /// </summary>
 public virtual void Log(string message, MessageSeverity severity = MessageSeverity.Info)
 {
     if (severity >= MinimumSeverity)
     {
         LogInternal(message, severity);
     }
 }
Пример #18
0
        /// <summary>Init the competition state.</summary>
        /// <param name="benchmarkType">Type of the benchmark.</param>
        /// <param name="competitionConfig">The config for the competition.</param>
        internal void FirstTimeInit(
            [NotNull] Type benchmarkType,
            [NotNull] ICompetitionConfig competitionConfig)
        {
            Code.NotNull(benchmarkType, nameof(benchmarkType));
            Code.NotNull(competitionConfig, nameof(competitionConfig));

            lock (_lockKey)
            {
                AsserIsInInit();

                _stopwatch.Restart();

                BenchmarkType = benchmarkType;
                Config        = competitionConfig;
                Logger        = competitionConfig.GetCompositeLogger();

                RunNumber = 0;
                RunsLeft  = 1;

                HighestMessageSeverityInRun = MessageSeverity.Verbose;
                HighestMessageSeverity      = MessageSeverity.Verbose;
                MessagesInRun  = 0;
                LastRunSummary = null;

                Completed = false;
                _summaries.Clear();
                _messages.Clear();
            }
        }
Пример #19
0
 protected Message(MessageSeverity severity, MessageCode code, string message)
 {
     Severity = severity;
     Code     = code;
     Location = Runtime.Location.NoLocation;
     Msg      = message;
 }
Пример #20
0
        protected internal override void Log(string message, MessageSeverity severity)
        {
            lock (_syncRoot)
            {
                var prevColor = Console.ForegroundColor;
                try
                {
                    switch (severity)
                    {
                    case MessageSeverity.Information:
                        Console.ForegroundColor = InfoColor;
                        break;

                    case MessageSeverity.Warning:
                        Console.ForegroundColor = WarningColor;
                        break;

                    case MessageSeverity.Error:
                        Console.ForegroundColor = ErrorColor;
                        break;

                    default:
                        break;
                    }
                    Log(Formatter(severity.ToString(), TrimExcess(message)));
                    ++Sucesses;
                }
                finally
                {
                    Console.ForegroundColor = prevColor;
                }
            }
        }
 public Toast(MessageSeverity itemType, string itemMessage, double itemTime, int itemOwnerId)
 {
     ItemType    = itemType;
     ItemMessage = itemMessage;
     ItemTime    = itemTime;
     ItemOwnerId = itemOwnerId;
 }
Пример #22
0
        public void Log(string message, MessageSeverity severity)
        {
            switch (severity)
            {
            case MessageSeverity.Info:
                Android.Util.Log.Info("Logger/Info", message);
                break;

            case MessageSeverity.Debug:
                Android.Util.Log.Debug("Logger/Debug", message);
                break;

            case MessageSeverity.Warning:
                Android.Util.Log.Warn("Logger/Warning", message);
                break;

            case MessageSeverity.Error:
                Android.Util.Log.Error("Logger/Error", message);
                break;

            case MessageSeverity.Critical:
                Android.Util.Log.Wtf("Logger/Critical", message);
                break;
            }
        }
Пример #23
0
        public void ReportMergeableMessage(MessageSeverity severity, string message, string argument, bool oneLineFormat)
        {
            var key = new Key {
                Severity = severity, Text = message
            };

            if (!_MergeableMessages.TryGetValue(key, out var list))
            {
                _MergeableMessages[key] = list = new MergeableMessage {
                    Message = message, OneLineFormat = oneLineFormat
                }
            }
            ;

            list.Add(argument);

            RaiseDebuggerEventIfEnabled();
        }

        void RaiseDebuggerEventIfEnabled()
        {
            if (_StopOnErrors)
            {
                Debugger.Break();
            }
        }
Пример #24
0
        private static Level GetLoggingLevel(MessageSeverity severity)
        {
            Level lvl;

            switch (severity)
            {
            case MessageSeverity.Debug:
                lvl = Level.Debug;
                break;

            case MessageSeverity.Info:
                lvl = Level.Info;
                break;

            case MessageSeverity.Warn:
                lvl = Level.Warn;
                break;

            case MessageSeverity.Error:
                lvl = Level.Error;
                break;

            case MessageSeverity.Fatal:
                lvl = Level.Fatal;
                break;

            default:
                lvl = Level.Notice;
                break;
            }
            return(lvl);
        }
        public static CompilationMessage Create(ITokenStream source, Interval errorLocation, MessageCode code, string file,
                                                string helpfullmessage   = null,
                                                MessageSeverity severity = MessageSeverity.Error)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (errorLocation.Equals(Interval.Invalid))
            {
                throw new ArgumentOutOfRangeException(nameof(errorLocation));
            }

            //Interval of 10 before, 10 after error
            //TODO: check against 0, source.Lenght
            Interval before = new Interval(Math.Max(errorLocation.a - 11, 0), Math.Max(errorLocation.a - 1, 0));
            Interval after  = new Interval(Math.Min(errorLocation.b + 1, source.Size), Math.Min(errorLocation.b + 11, source.Size));

            string beforestring = source.GetText(before);
            string error        = source.GetText(errorLocation);
            string afterstring  = source.GetText(after);


            return(new CompilationMessage(severity, code, beforestring, error, afterstring, helpfullmessage, file, errorLocation.a));
        }
Пример #26
0
        internal void AddBuildError(string file, int line, int column, string errCode,
                                    string message, MessageSeverity sev)
        {
            var item = this.CreateItem(file, line, column, 1, errCode, message, sev, ErrorSource.Build, Project.Caption);

            this.AddError(BuildErrors, item);
        }
Пример #27
0
        /// <summary>Adds a message for the competition.</summary>
        /// <param name="messageSource">Source of the message.</param>
        /// <param name="messageSeverity">Severity of the message.</param>
        /// <param name="messageText">Text of the message.</param>
        public void WriteMessage(
            MessageSource messageSource, MessageSeverity messageSeverity,
            [NotNull] string messageText)
        {
            AssertIsInCompetition();

            Message message;

            lock (_messages)
            {
                message = new Message(
                    RunNumber, MessagesInRun + 1,
                    Elapsed,
                    messageSource, messageSeverity, messageText);

                _messages.Add(message);
                MessagesInRun++;

                if (HighestMessageSeverityInRun < messageSeverity)
                {
                    HighestMessageSeverityInRun = messageSeverity;
                }
                if (HighestMessageSeverity < messageSeverity)
                {
                    HighestMessageSeverity = messageSeverity;
                }
            }

            if (Logger == null)
            {
                throw CodeExceptions.InvalidOperation(
                          $"Please call {nameof(FirstTimeInit)}() first.");
            }
            Logger.LogMessage(message);
        }
 public static CompilationMessage CreateNonCodeMessage(
     MessageCode code,
     string helpfullmessage   = null,
     MessageSeverity severity = MessageSeverity.Error)
 {
     return(new CompilationMessage(severity, code, "", "", "", helpfullmessage, null, -1));
 }
Пример #29
0
        internal void AddIntellisenseError(string file, int line, int column, int length, string errCode,
                                           string message, MessageSeverity sev)
        {
            var item = this.CreateItem(file, line, column, length, errCode, message, sev, ErrorSource.Other, Project.Caption);

            this.AddError(IntellisenseErrors, item);
        }
Пример #30
0
 /// <summary>
 /// Used only for exception-based payload logging; variation of RecordMessage which takes an exception parameter.
 /// Calls RecordMessage if no exception is supplied, or if this is not an ApiMessage (i.e. payload message), or if
 /// no MessageLoggingFilter property is configured on the log manager.  Otherwise, the exception logic is applied: the
 /// method will continue calling RecordMessage only if the exception matches the configured MessageLoggingFilter property.
 /// </summary>
 /// <param name="Message"></param>
 /// <param name="Type"></param>
 /// <param name="Severity"></param>
 /// <param name="Ex"></param>
 public void RecordPayloadOnException(string Message, MessageType Type, MessageSeverity Severity, Exception Ex)
 {
     if (Type != MessageType.ApiMessage || mMessageLoggingFilter == null || mMessageLoggingFilter.Matches(Ex))
     {
         RecordMessage(Message, Type, Severity);
     }
 }
Пример #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CompilationMessage"/> class.
 /// </summary>
 /// <param name="message">The compilation message text</param>
 /// <param name="lineNumber">Line number in source code relevant to the message</param>
 /// <param name="character">Column in the source code relevant to the message</param>
 /// <param name="severity">Message severity</param>
 public CompilationMessage(string message, int lineNumber, int character, MessageSeverity severity)
 {
     this.Message    = message;
     this.LineNumber = lineNumber;
     this.Character  = character;
     this.Severity   = severity;
 }
		public void Message(MessageSeverity severity, int code, string message, params object[] args) {
			var msg = new Message(severity, code, Region, message, args);
			string s = msg.ToString();	// Ensure this does not throw an exception
			AllMessages.Add(msg);
			if (_logToConsole)
				Console.WriteLine(s);
		}
Пример #33
0
 protected Message(MessageSeverity severity, MessageCode code, ILocated located)
 {
     Severity = severity;
     Code     = code;
     Location = located.Location;
     Msg      = Subject(Location);
 }
		public Message(MessageSeverity severity, int code, DomRegion region, string format, params object[] args) {
			Severity = severity;
			Code = code;
			Region = region;
			Format = format;
			Args = args;
			FormattedMessage = Args.Length > 0 ? string.Format(Format, Args) : Format;
		}
 public Message(MessageSeverity severity, int code, DomRegion region, string format, params object[] args)
 {
     Severity = severity;
     Code = code;
     Region = region;
     Format = format;
     Args = args;
 }
		public void Message(MessageSeverity severity, int code, string message, params object[] args) {
			if (severity == MessageSeverity.Error) {
				_log.LogError(null, string.Format("CS{0:0000}", code), null, Region.FileName, Region.BeginLine, Region.BeginColumn, Region.EndLine, Region.EndColumn, message, args);
			}
			else {
				_log.LogWarning(null, string.Format("CS{0:0000}", code), null, Region.FileName, Region.BeginLine, Region.BeginColumn, Region.EndLine, Region.EndColumn, message, args);
			}
		}
Пример #37
0
        protected override void LogInternal(string message, MessageSeverity severity = MessageSeverity.Info)
        {
            base.LogInternal(message, severity);

            if (severity == MessageSeverity.Error)
            {
                Debug.Log("##teamcity[message text='" + message + "'" + "status='ERROR']");
            }
        }
 public void Message(MessageSeverity severity, int code, string file, TextLocation location, string message, params object[] args)
 {
     if (severity == MessageSeverity.Error) {
         _log.LogError(null, string.Format("CS{0:0000}", code), null, file, location.Line, location.Column, location.Line, location.Column, message, args);
     }
     else {
         _log.LogWarning(null, string.Format("CS{0:0000}", code), null, file, location.Line, location.Column, location.Line, location.Column, message, args);
     }
 }
 public Message(MessageSeverity severity, int code, string file, TextLocation location, string format, params object[] args)
 {
     Severity = severity;
     Code = code;
     File = file;
     Location = location;
     Format = format;
     Args = args;
 }
Пример #40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GoldAddin.CompilerMessage"/> class.
 /// </summary>
 public CompilerMessage(MessageSeverity severity, string text, string fileName, int line,
     int column, string rawText)
 {
     this.severity = severity;
     this.text = text;
     this.fileName = fileName;
     this.line = line;
     this.column = column;
     this.rawText = rawText;
 }
Пример #41
0
 internal void WriteToDB(string message, MessageSeverity severity = MessageSeverity.Notice)
 {
     context.TransactionLogs.Add(new TransactionLog
     {
         Severity = severity,
         Message = message,
         TimeStamp = DateTime.Now
     });
     context.SaveChanges();
 }
Пример #42
0
 public void Report(string id, MessageSeverity severity, string message)
 {
     Invoke(new Action(() =>
         {
             var logger = NamedReporters.GetReporterById(id);
             EnsureReporterIsSelected(logger);
             UpdateOutputLog(logger);
             AppendText(logger, severity, message + Environment.NewLine);
         }));
 }
Пример #43
0
 private ValidationMessage(int? artId, string messageType, DateTime? messageDate, MessageSeverity? severity,
     string description, string affectedId, string affectedDecr)
 {
     _artId = artId;
     _messageType = messageType;
     _messageDate = messageDate;
     _severity = severity;
     _description = description;
     _affectedId = affectedId;
     _affectedDescr = affectedDecr;
 }
Пример #44
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="Message"></param>
		/// <param name="Severity"></param>
		public override void RecordMessage(string Message, MessageSeverity Severity)
		{
			StringBuilder message = new StringBuilder();

			message.Append("["+DateTime.Now.ToString(System.Globalization.CultureInfo.CurrentUICulture));
			message.Append(", " + Severity.ToString());
			message.Append("]\r\n" + Message + "\r\n");

			// Force the write to the underlying file
			Console.WriteLine(message);
		}
        public void AddLogMessage(MessageSeverity severity, string message)
        {
            if (this.logListView.Items.Count >= MaxLogSize)
            {
                this.logListView.Items.RemoveAt(0);
            }

            var text = string.Format("{0} [{1:HH:mm:ss.fff}] {2}", severity.ToString().ToUpper(), DateTime.Now, message);
            this.logListView.Items.Add(text);
            this.logListView.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            this.logListView.TopItem = this.logListView.Items[this.logListView.Items.Count - 1];
        }
Пример #46
0
        private void AppendText(INamedProgressReporter reporter, MessageSeverity severity, string message)
        {
            var builder = _reporterContexts[reporter].Builder;
            string formatted = string.Format("[{0}]: {1}", severity, message);
            builder.Append(formatted);

            if (outputSourcesToolStripComboBox.SelectedIndex == NamedReporters.IndexOf(reporter))
            {
                textBox1.AppendText(formatted);
                ScrollToEnd();
            }
        }
		public void Message(MessageSeverity severity, int code, string message, params object[] args) {
			var msg = new Message(severity, code, Region, message, args);
			foreach (var a in args) {
				try {
					new BinaryFormatter().Serialize(new MemoryStream(), a);
				}
				catch (Exception) {
					throw new Exception("Error serializing argument " + a);
				}
			}
			string s = msg.ToString();	// Ensure this does not throw an exception
			AllMessages.Add(msg);
			if (_logToConsole)
				Console.WriteLine(s);
		}
 private static void DefaultMessageReceived(MessageSeverity severity, string message)
 {
     switch (severity)
       {
     case MessageSeverity.Error:
       Console.Error.WriteLine ("ERROR: {0}", message);
       break;
     case MessageSeverity.Warning:
       Console.WriteLine ("WARNING: {0}", message);
       break;
     default:
       Console.WriteLine (message);
       break;
       }
 }
Пример #49
0
        public void SetMessage(MessageSeverity severity, string message)
        {
            switch (severity)
            {
                case MessageSeverity.Error:
                    _pictureBox.Image = NeutralResources.error;
                    break;

                case MessageSeverity.Warning:
                    _pictureBox.Image = NeutralResources.warning;
                    break;

                case MessageSeverity.Information:
                    _pictureBox.Image = NeutralResources.information;
                    break;
            }

            _message.Text = message;
        }
Пример #50
0
 protected override void LogInternal(string message, MessageSeverity severity = MessageSeverity.Info)
 {
     switch (severity)
     {
         case MessageSeverity.Debug:
             Debug.Log(message);
             break;
         case MessageSeverity.Info:
             Debug.Log(message);
             break;
         case MessageSeverity.Warning:
             Debug.LogWarning(message);
             break;
         case MessageSeverity.Error:
             Debug.LogError(message);
             break;
         default:
             throw new ArgumentOutOfRangeException("Severity out of bounds");
     }
 }
Пример #51
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="Message"></param>
		/// <param name="Severity"></param>
		public override void RecordMessage(string Message, MessageSeverity Severity)
		{
			StringBuilder message = new StringBuilder();
			System.Diagnostics.EventLog eventLog = 	new System.Diagnostics.EventLog();
         
			// Create the source if it does not already exist
			if( !System.Diagnostics.EventLog.SourceExists(mEventLogSource) )
			{
				System.Diagnostics.EventLog.CreateEventSource(mEventLogSource, mEventLogName);
			}
			eventLog.Source = mEventLogSource;
			eventLog.MachineName = mMachineName;
         
			// Determine what the EventLogEventType should be 
			// based on the LogSeverity passed in
			EventLogEntryType type = EventLogEntryType.Information;

			switch(Severity)
			{
				case MessageSeverity.Informational:
					type = EventLogEntryType.Information;
					break;
				case MessageSeverity.Failure:
					type = EventLogEntryType.FailureAudit;
					break;
				case MessageSeverity.Warning:
					type = EventLogEntryType.Warning;
					break;
				case MessageSeverity.Error:
					type = EventLogEntryType.Error;
					break;
			}


			message.Append("["+DateTime.Now.ToString(System.Globalization.CultureInfo.CurrentUICulture));
			message.Append(", " + Severity.ToString());
			message.Append("]\r\n" + Message + "\r\n");

			eventLog.WriteEntry(message.ToString(), type);
		}
Пример #52
0
 /// <summary>
 /// Formats and reports a message to the logger.
 /// </summary>
 /// <param name="reporter">The reporter to send the message to.</param>
 /// <param name="severity">The severity of the message.</param>
 /// <param name="format">The format of the message to send.</param>
 /// <param name="arguments">An object array containing zero or more arguments to be formatted.</param>
 public static void Report(this IProgressReporter reporter, MessageSeverity severity, string format, params object[] arguments)
 {
     reporter.Report(severity, string.Format(format, arguments));
 }
Пример #53
0
 public void Report(MessageSeverity severity, string message)
 {
 }
Пример #54
0
 public LogEventArgs(MessageSeverity severity, Int64 timestamp, string message) : base(LeapEvent.EVENT_LOG_EVENT)
 {
   this.severity = severity;
   this.message = message;
   this.timestamp = timestamp;
 }
 public void Message(MessageSeverity severity, int code, string message, params object[] args)
 {
     WithActualOut(() => _er.Message(severity, code, message, args));
     if (severity == MessageSeverity.Error)
         HasErrors = true;
 }
Пример #56
0
 public void ReportMessage(MessageSeverity severity, string message,
     ISourcePosition position = null)
 {
     position = position ?? _invocation.Position;
     _session.Target.Loader.ReportMessage(Message.Create(severity, message, position,null));
 }
Пример #57
0
 public virtual void ShowMessage(string titre, string message, MessageSeverity msgSeveriry)
 {
     vb.ViewMessage = new Tuple<string, string, MessageSeverity>(titre, message, msgSeveriry);
 }
Пример #58
0
 private void PublishMessage(MessageSeverity severity, string message)
 {
     if (this.Observer != null)
     {
         this.Observer.HandleMessage(this, severity, message);
     }
 }
Пример #59
0
 public void Log(string message, MessageSeverity severity)
 {
     Debug.WriteLine("Log/{0} : {1}", severity, message);
 }
 private bool GetRowVisibility(MessageSeverity severity)
 {
     switch (severity)
     {
         case MessageSeverity.Error:
             return errorsToolStripButton.Checked;
         case MessageSeverity.Warning:
             return warningsToolStripButton.Checked;
         case MessageSeverity.Message:
             return messagesToolStripButton.Checked;
     }
     return false;
 }