示例#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);
        }
 /// <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;
 }
        /// <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);
        }
        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;
        }
		/// <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));
        }
        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));
 }
        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);
			}
		}
        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);
 }
 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;
 }