/// <summary> /// Used for player QA events /// </summary> /// <param name="businessID"> /// The event identifier. F.x. "FailedToLoadLevel" <see cref="System.String"/> /// </param> /// <param name="message"> /// A string detailing the event, F.x. the stack trace from an exception <see cref="System.String"/> /// </param> /// <param name="stack"> /// If true any identical messages in the queue will be merged/stacked as a single message, to save server load /// </param> private void CreateNewEvent(SeverityType severity, string message, float? x, float? y, float? z, bool stack) { Hashtable parameters = new Hashtable() { { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Severity], severity.ToString() }, { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Message], message }, { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Level], GA.SettingsGA.CustomArea.Equals(string.Empty)?Application.loadedLevelName:GA.SettingsGA.CustomArea } }; if (x.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.X], (x*GA.SettingsGA.HeatmapGridSize.x).ToString()); } if (y.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Y], (y*GA.SettingsGA.HeatmapGridSize.y).ToString()); } if (z.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Z], (z*GA.SettingsGA.HeatmapGridSize.z).ToString()); } GA_Queue.AddItem(parameters, GA_Submit.CategoryType.GA_Error, stack); }
public void GetExceptionMessage_WithSmartObjectException() { //Arrange var ctor = typeof(SmartObjectExceptionData).GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(); string serviceName = Guid.NewGuid().ToString(); string serviceGuid = Guid.NewGuid().ToString(); string message = Guid.NewGuid().ToString(); string innerExceptionMessage = Guid.NewGuid().ToString(); const SeverityType severity = SeverityType.Error; var smartObjectExceptionData = (SmartObjectExceptionData)ctor.Invoke(new object[] { serviceName, serviceGuid, message, innerExceptionMessage, severity }); var collection = new SmartObjectExceptionDataCollection { smartObjectExceptionData }; var exception = new SmartObjectException(collection); string expected = $@"Service: {serviceName} Service Guid: {serviceGuid} Severity: {severity.ToString()} Error Message: {message} InnerException Message: {innerExceptionMessage}"; // Action var actual = ExceptionExtensions.GetExceptionMessage(exception); // Assert Assert.AreEqual(Regex.Replace(expected.Trim(), @"\s+", " "), Regex.Replace(actual.Trim(), @"\s+", " ")); }
/// **************************************************************** /// public WriteIf [static] /// ---------------------------------------------------------------- /// <summary> /// Writes a message to the debugging logs if the specified /// condition is true. /// </summary> /// ---------------------------------------------------------------- /// <param name="condition"> /// The condition to verify. If the condition is true, the /// given message is displayed. /// </param> /// /// <param name="severity"> /// The severity type. /// </param> /// /// <param name="category"> /// The category type. /// </param> /// /// <param name="message"> /// The message to log. /// </param> /// **************************************************************** /// public static void WriteIf(bool condition, SeverityType severity, CategoryType category, string message) { if (true == condition) { Write(severity, category, message); } }
/// <summary> /// Creates a user defined error event /// </summary> /// <param name="ex"></param> /// <param name="properties"></param> /// <param name="severity"></param> public void Log(Exception ex, Dictionary <string, string> properties = null, SeverityType severity = SeverityType.Error) { var logEvent = new LogEvent() { Severity = severity, Summary = ex.Message, Detail = ex.StackTrace, DeviceUID = _deviceUID, UserUID = _userUID, Tag = ex.GetType().Name, Source = ex.Source, Properties = new Dictionary <string, string>() }; foreach (DictionaryEntry p in ex.Data) { logEvent.Properties.Add(p.Key.ToString(), p.Value.ToString()); } // append additional user data (when provided) if (properties != null) { foreach (var p in properties) { logEvent.Properties.Add(p.Key, p.Value); } } log(logEvent); }
private LogMessage(SeverityType severity, string message, Exception exception) { Severity = severity; Message = message; Exception = exception; Stamp = DateTime.Now; }
/// <summary> /// Used for player QA events /// </summary> /// <param name="businessID"> /// The event identifier. F.x. "FailedToLoadLevel" <see cref="System.String"/> /// </param> /// <param name="message"> /// A string detailing the event, F.x. the stack trace from an exception <see cref="System.String"/> /// </param> /// <param name="stack"> /// If true any identical messages in the queue will be merged/stacked as a single message, to save server load /// </param> private void CreateNewEvent(SeverityType severity, string message, float?x, float?y, float?z, bool stack) { Hashtable parameters = new Hashtable() { { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Severity], severity.ToString() }, { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Message], message }, { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Level], GA.SettingsGA.CustomArea.Equals(string.Empty)?Application.loadedLevelName:GA.SettingsGA.CustomArea } }; if (x.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.X], (x * GA.SettingsGA.HeatmapGridSize.x).ToString()); } if (y.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Y], (y * GA.SettingsGA.HeatmapGridSize.y).ToString()); } if (z.HasValue) { parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Z], (z * GA.SettingsGA.HeatmapGridSize.z).ToString()); } GA_Queue.AddItem(parameters, GA_Submit.CategoryType.GA_Error, stack); }
/// **************************************************************** /// public WriteDebugger [static] /// ---------------------------------------------------------------- /// <summary> /// Writes a message to the debugger. /// </summary> /// ---------------------------------------------------------------- /// <param name="severity"> /// The severity type. /// </param> /// /// <param name="category"> /// The category type. /// </param> /// /// <param name="message"> /// The message. /// </param> /// **************************************************************** /// public static void WriteDebugger(SeverityType severity, CategoryType category, string message) { try { string text = string.Format( "{0,-4} {1,-4} {2}", severity.ToString().Substring(0, 4).ToUpper(), category.ToString().Substring(0, 4).ToUpper(), message.Replace("\r\n", "\r\n\t\t")); // // Write out the debugger message. // System.Diagnostics.Trace.WriteLine(text); } catch (Exception) { // // WriteDebugger is used as a last ditch logging mechanism // in many cases. This should never throw an exception, // but if it does, there really isn't any more we can do // about it. We'll simply eat the error. // } }
/// <summary> /// Used to Log any data or exceptions that occured during running the program. /// </summary> /// <param name="Msg">the user friendly massage or any informations</param> /// <param name="category">Mean the project who have the problem or who want to write a message</param> /// <param name="priority">mean the important of the logging ex.High or Low</param> /// <param name="Type">the Type of the message ex.Error or info.</param> /// <param name="Properties">any addition informations</param> public static void Log(string Msg, Category category, Priority priority, SeverityType Type, IDictionary <string, object> Properties) { #region Filling Extra properties Logger.Log(Msg, category, priority, Type, Properties); #endregion }
public LogMessage(SeverityType severity, string message, Exception exception) { Severity = severity; Message = message; Exception = exception; Stamp = DateTime.Now; }
public Response(IDictionary <SeverityType, IEnumerable <string> > reports, SeverityType severity) { this.Reports = reports; this.Severity = severity; this.Id = Guid.NewGuid(); this.LastUpdated = DateTime.UtcNow; }
public void LogToServerTest() { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer.Write("Hello"); #region Loading Variables //ServerLoggingHandler target = new ServerLoggingHandler(); // TODO: Initialize to an appropriate value string Msg = "Hello Logging Server Side "; Category category = Category.ServerData; Priority priority = Priority.Highest; SeverityType Type = SeverityType.Information; IDictionary <string, object> Properties = new Dictionary <string, object>(); Properties.Add("TestKey", "test value"); #endregion #region Acual Test LoggingProvider <ServerLoggingHandler> .Log(Msg, category); LoggingProvider <ServerLoggingHandler> .Log(Msg, category, priority); LoggingProvider <ServerLoggingHandler> .Log(Msg, category, priority, Type); LoggingProvider <ServerLoggingHandler> .Log(Msg, category, Properties); LoggingProvider <ServerLoggingHandler> .Log(Msg, category, priority, Type, Properties); #endregion }
/// <summary> /// Create DiagnosticHelper instance based on Microsoft.CodeAnalysis.<see cref="Diagnostic"/> class. /// </summary> /// <param name="diagnostic">Diagnostic info, which is use to create helper object</param> /// <returns>Helper object based on <see cref="diagnostic"/></returns> public static DiagnosticHelper Create(Diagnostic diagnostic) { // Set proper severity type SeverityType severity = SeverityType.None; if (diagnostic.Severity == DiagnosticSeverity.Error) { severity = SeverityType.Error; } else if (diagnostic.Severity == DiagnosticSeverity.Warning) { severity = SeverityType.Warning; } else if (diagnostic.Severity == DiagnosticSeverity.Info) { severity = SeverityType.Info; } // Create helper object return(new DiagnosticHelper { Severity = severity, Location = new CodeLocation(diagnostic.Location), Information = diagnostic.GetMessage(), SyntaxNode = diagnostic.Location .SourceTree ?.GetRoot() .FindNode(diagnostic.Location.SourceSpan), }); }
private void PrepareLogMessageAndRaise(string body, LevelType level, SeverityType severity, params object[] parameters) { string text = ""; try { text = parameters.Length == 0 ? body : string.Format(body, parameters); } catch { text = body; } Event msg = NewEvent(); msg.Lg = new Log() { Format = FormatType.Plain, Body = text, Level = level, Severity = severity }; OnNewMessage(msg); }
/// **************************************************************** /// public Write [static] /// ---------------------------------------------------------------- /// <summary> /// Writes a message to the debugging logs. /// </summary> /// ---------------------------------------------------------------- /// <param name="severity"> /// The Severity type. /// </param> /// /// <param name="category"> /// The category type. /// </param> /// /// <param name="message"> /// The message to log. /// </param> /// ---------------------------------------------------------------- /// <remarks> /// Debugging information is logged to the debugger, log file, /// and event log depending on the level of the following /// configuration settings: /// /// Debug.DebuggerLevel /// Debug.EventLogLevel /// Debug.FileLogLevel /// /// Where the trace level is the highest severity to log: /// 0 = none /// 1 = errors /// 2 = warnings /// 3 = failure audit messages /// 4 = success audit messages /// 5 = information messages /// 6 = all (verbose) /// </remarks> /// **************************************************************** /// public static void Write(SeverityType severity, CategoryType category, string message) { // // Write to the debugger if the level setting is high enough. // if ((int)severity <= debuggerLevel.GetInt()) { WriteDebugger(severity, category, message); } // // Write to the event log if the level setting is high enough. // if ((int)severity <= eventLogLevel.GetInt()) { WriteEventLog(severity, category, OperatorMessageType.None, message); } // // Write to the file log if the level setting is high enough. // if ((int)severity <= fileLogLevel.GetInt()) { WriteFileLog(severity, category, message); } }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { SeverityType severity = SeverityType.Debug; if (IsEnabled(logLevel)) { switch (logLevel) { case LogLevel.Information: severity = SeverityType.Informational; break; case LogLevel.Warning: severity = SeverityType.Warning; break; case LogLevel.Error: severity = SeverityType.Error; break; case LogLevel.Critical: severity = SeverityType.Critical; break; } } else { return; } if (formatter == null) { throw new ArgumentNullException(nameof(formatter)); } string message = formatter(state, exception); if (!String.IsNullOrEmpty(message)) { int priority = ((int)FacilityType.Local0 * 8) + (int)severity; // (Facility * 8) + Severity = Priority string msg = String.Format("<{0}>{1:MMM dd HH:mm:ss} {2} {3}", priority, DateTime.Now, _host, _name + ": " + message); // RFC 3164 header format UdpClient udp = new UdpClient(); byte[] raw = Encoding.ASCII.GetBytes(msg); try { udp.SendAsync(raw, Math.Min(raw.Length, 1024), _settings.ServerHost, _settings.ServerPort); } finally { #if NET452 udp.Close(); #else udp.Dispose(); #endif } } }
public Bug(string id, string title, PriorityType priority, SeverityType severity, IList <string> steps, string description) : base(id, title, description) { this.priorityType = priority; this.severityType = severity; this.bugStatus = BugStatus.Active; this.steps = steps; }
public ValidationMessage(string message, SeverityType severity, int lineNumber, int linePosition, Exception exception) { Message = message; Severity = severity; LineNumber = lineNumber; LinePosition = linePosition; Exception = exception; }
public LogEntry(string _caption, SeverityType _severity, bool _isLogOnly, string _message) { Caption = _caption; Message = _message; Severity = _severity; Timestamp = DateTime.Now; IsLogOnly = _isLogOnly; }
public ResultCode(SeverityType severity, bool custom, int facility, int code) { ID = 0; Severity = severity; Custom = custom; Facility = facility; Code = code; }
// // Note: All calls to this function should occur in administrator initiated // processes. No calls to this function should as a result of an HTTP request from // a SOAP API. // This is verified to be true on 3/1/2002 by creeves // public static void OperatorMail(SeverityType severity, CategoryType category, OperatorMessageType messageId, string message) { string mailTo = Config.GetString("Debug.MailTo", null); if (null == mailTo) { Debug.Write( SeverityType.Info, CategoryType.Config, "Skipping send of operator mail. Configuration setting 'Debug.MailTo' not set."); return; } Debug.VerifySetting("Debug.MailFrom"); try { string mailCc = Config.GetString("Debug.MailCc", null); string mailSubject = Config.GetString( "Debug.MailSubject", "Operator message from {0}. Severity: {1}, Category: {2}"); MailMessage mail = new MailMessage(); mail.To = mailTo; mail.From = Config.GetString("Debug.MailFrom"); mail.Subject = String.Format( mailSubject, System.Environment.MachineName, severity.ToString(), category.ToString(), (int)messageId); if (null != mailCc) { mail.Cc = mailCc; } mail.BodyFormat = MailFormat.Text; mail.Body = "SEVERITY: " + severity.ToString() + "\r\n" + "CATEGORY: " + category.ToString() + "\r\n" + "EVENT ID: " + (int)messageId + "\r\n\r\n" + message; SmtpMail.Send(mail); } catch (Exception e) { Debug.OperatorMessage( SeverityType.Error, CategoryType.None, OperatorMessageType.CouldNotSendMail, "Could not send operator mail.\r\n\r\nDetails:\r\n\r\n" + e.ToString()); } }
public static void WriteError(object errorMessage, SeverityType severity, string errorCategory, IDictionary <string, object> properties) { //var worker = new BackgroundWorker(); //worker.DoWork += delegate(object sender, DoWorkEventArgs e) //{ Writer.WriteError(errorMessage, severity, errorCategory, properties); //}; //worker.RunWorkerAsync(); }
/// **************************************************************** /// public WriteEventLog [static] /// ---------------------------------------------------------------- /// <summary> /// Writes a message to the event log. /// </summary> /// ---------------------------------------------------------------- /// <param name="severity"> /// The severity type. /// </param> /// /// <param name="category"> /// The category type. /// </param> /// /// <param name="messageId"> /// The message type. /// </param> /// /// <param name="message"> /// The message. /// </param> /// **************************************************************** /// public static void WriteEventLog(SeverityType severity, CategoryType category, OperatorMessageType messageId, string message) { readWriteLock.AcquireReaderLock(Constants.ReadLockTimeout); try { // // Map the severity type to an event log entry type. // System.Diagnostics.EventLogEntryType entryType; switch (severity) { case SeverityType.Error: entryType = System.Diagnostics.EventLogEntryType.Error; break; case SeverityType.Warning: entryType = System.Diagnostics.EventLogEntryType.Warning; break; case SeverityType.PassAudit: entryType = System.Diagnostics.EventLogEntryType.SuccessAudit; break; case SeverityType.FailAudit: entryType = System.Diagnostics.EventLogEntryType.FailureAudit; break; default: // // SeverityType.Info and Verbose are mapped to info // entryType = System.Diagnostics.EventLogEntryType.Information; break; } System.Diagnostics.EventLog.WriteEntry( "UDDIRuntime", message, entryType, (int)messageId, (short)category); } catch (Exception e) { WriteDebugger( SeverityType.Error, CategoryType.None, "Could not write to event log.\r\n\r\nDetails:\r\n" + e.ToString()); } finally { readWriteLock.ReleaseReaderLock(); } }
public LogEntry(Exception _exception, string _caption, SeverityType _severity, bool _isLogOnly, string _message) { IsException = true; Exception = _exception; Caption = _caption; Message = _message; Severity = _severity; Timestamp = DateTime.Now; IsLogOnly = _isLogOnly; }
private void WriteError(object errorMessage, SeverityType severity, string errorCategory, IDictionary <string, object> properties) { var props = EnsureProperties(properties); props.Add(XFConstants.EventWriter.Message, errorMessage.ToString()); props.Add(XFConstants.EventWriter.ErrorSeverity, severity.ToString()); props.Add(XFConstants.EventWriter.Category, errorCategory); props.Add(XFConstants.EventWriter.EventType, EventTypeOption.Error); LocalPublish(EventTypeOption.Error, props); }
//public Bug(string title) : base(title) //{ // base.Тype = WorkItemType.Bug; //} public Bug(string title, string description = "description", List <string> steps = null, PriorityType priority = PriorityType.None, SeverityType severity = SeverityType.None, BugStatus bugStatus = BugStatus.None, Person assignee = null, List <IComment> comments = null, List <Activity> history = null) : base(title, description, assignee, comments, history) { base.Тype = WorkItemType.Bug; this.Steps = steps; this.Priority = priority; this.Severity = severity; this.BugStatus = bugStatus; }
public static void SendMessage(string messageToSend, string sectionToSend, SeverityType severityTypeToSend) { var resultSentMessage = false; ContainerAccessPoint.Container.Resolve <IEventAggregator>().GetEvent <AlertEvent>().Publish(new Alert { Section = sectionToSend, Severity = severityTypeToSend, Id = messageToSend }); }
private void dgvMain_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { SeverityType x = (SeverityType)Enum.Parse(typeof(SeverityType), this.dataGridView1[1, e.RowIndex].Value.ToString()); if ((int)x < 5) { this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(0xe0, 0x00, 0x00); } }
/// <summary> /// Used for player QA events /// </summary> /// <param name="businessID"> /// The event identifier. F.x. "FailedToLoadLevel" <see cref="System.String"/> /// </param> /// <param name="message"> /// A string detailing the event, F.x. the stack trace from an exception <see cref="System.String"/> /// </param> /// <param name="stack"> /// If true any identical messages in the queue will be merged/stacked as a single message, to save server load /// </param> private void CreateNewEvent(SeverityType severity, string message, bool stack) { Hashtable parameters = new Hashtable() { { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Severity], severity.ToString() }, { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Message], message }, { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Level], GA.SettingsGA.CustomArea.Equals(string.Empty)?Application.loadedLevelName:GA.SettingsGA.CustomArea } }; GA_Queue.AddItem(parameters, GA_Submit.CategoryType.GA_Error, stack); }
public void SetMessage(SeverityType severityType, string message = null) { lock (messageLock) { if (severityType == SeverityType.None || string.IsNullOrEmpty(message)) { Message = string.Empty; } else { Message = string.Format("{0}: {1}", severityType, message); } } }
internal CanValidateOwnerCheck(CalendarValidationContext context) { SeverityType severity = SeverityType.FatalError; if (context.BaseItem == null || context.BaseItem.IsCancelled) { severity = SeverityType.Information; } else if (context.BaseRole == RoleType.Organizer && (context.Attendee.ResponseType == ResponseType.NotResponded || context.Attendee.ResponseType == ResponseType.None)) { severity = SeverityType.Warning; } this.Initialize(ConsistencyCheckType.CanValidateOwnerCheck, "Checks whether the counterpart user can be validated or not.", severity, context, null); }
protected virtual void LogToConsole(string body, LevelType level, SeverityType severity, params object[] parameters) { string text = ""; try { text = parameters.Length == 0 ? body : string.Format(body, parameters); } catch { text = body; } Console.WriteLine($"{DateTime.Now.ToString("HH:mm")} {level.ToString()} {severity.ToString()} | {text}"); }
public AnalysisResult( string findingMessage, SeverityType severity, string recommendation, string testType, IEnumerable <KeyValuePair <string, string> > additionalProps, IEnumerable <string> referenceUrl) { this.FindingMessage = findingMessage; this.Recommendation = recommendation; this.Severity = severity; this.AdditionalProperties = additionalProps; this.TestType = testType; this.ReferenceUrl = referenceUrl; }
public void NewEvent(SeverityType severity, string message, float x, float y, float z) { CreateNewEvent(severity, message, x, y, z, false); }
public void NewEvent(SeverityType severity, string message, Vector3 trackPosition) { CreateNewEvent(severity, message, trackPosition.x, trackPosition.y, trackPosition.z, false); }
public ValidationMessage(string message, SeverityType severity, int lineNumber, int linePosition) : this(message, severity, lineNumber, linePosition, null) { }
public AppException(string message, SeverityType severity) : base(message, severity) { }
public static void Log(SeverityType severity, string message, Exception exception, IEventManager eventmanager) { eventmanager.Publish(new LogMessage(severity, message, exception)); }
public static void Log(SeverityType severity, string message, IEventManager eventmanager) { Log(severity, message, null, eventmanager); }
public void NewEvent(SeverityType severity, string message) { CreateNewEvent(severity, message, null, null, null, false); }
public ValidationError(string errorMessage, object targetInstance, string propertyName, string validationType, SeverityType severityType) : this(errorMessage, targetInstance, propertyName) { this.ValidationType = validationType; this.SeverityType = severityType; }
public AppException(int errorCode, string message, SeverityType severity, Exception inner) : base(errorCode, message, severity, inner) { }
public void NewErrorEvent(SeverityType severity, string message) { CreateNewEvent(severity, message, true); }