// Methods static EventSeverity() { Fatal = new EventSeverity(0xc350, "FATAL"); Error = new EventSeverity(0x9c40, "ERROR"); Failure = new EventSeverity(0x8ca0, "FAIL"); Warning = new EventSeverity(0x7530, "WARNING"); Success = new EventSeverity(0x5dc0, "SUCCESS"); Info = new EventSeverity(0x4e20, "INFO"); Trace = new EventSeverity(0x2710, "TRACE"); Off = new EventSeverity(0, "OFF"); s_mapSeverity2EventLogEntryType = new Hashtable(); s_mapSeverity2EventLogEntryType[Fatal] = EventLogEntryType.Error; s_mapSeverity2EventLogEntryType[Error] = EventLogEntryType.Error; s_mapSeverity2EventLogEntryType[Warning] = EventLogEntryType.Warning; s_mapSeverity2EventLogEntryType[Info] = EventLogEntryType.Information; s_mapSeverity2EventLogEntryType[Trace] = EventLogEntryType.Information; s_mapSeverity2EventLogEntryType[Success] = EventLogEntryType.SuccessAudit; s_mapSeverity2EventLogEntryType[Failure] = EventLogEntryType.FailureAudit; }
public BaseEvent() { m_TimeStamp = DateTime.Now; m_Source = string.Empty; m_ThreadInfo = null; m_CallingMethod = null; m_StackDepth = 0; m_Message = string.Empty; m_Bag = new PropertyBag(); m_Severity = EventSeverity.Trace; m_EventID = 0; m_EventCategoryID = 0; try { StackTrace trace1 = new StackTrace(false); int num1 = 2; Type type1 = null; do { num1++; m_CallingMethod = trace1.GetFrame(num1).GetMethod(); type1 = m_CallingMethod.DeclaringType; } while ((num1 < trace1.FrameCount) && (typeof (ISkipStackFrame).IsAssignableFrom(type1) || type1.FullName.StartsWith("System."))); m_StackDepth = (trace1.FrameCount - num1) + 1; } catch { m_CallingMethod = null; } if (m_CallingMethod != null) { m_Source = m_CallingMethod.DeclaringType.FullName; } m_ThreadInfo = Instrumentation.CurrentThreadName; m_WindowsIdentityName = (string) m_IdentityCache[m_ThreadInfo]; if (m_WindowsIdentityName == null) { m_WindowsIdentityName = WindowsIdentity.GetCurrent().Name; m_IdentityCache.Add(m_ThreadInfo, m_WindowsIdentityName); } }
private static void SignTheEvent(string message, EventSeverity severity, params EventParameter[] values) { try { BusinessAuditEvent event1 = new BusinessAuditEvent(); event1.m_Message = message; event1.m_Severity = severity; if (values != null) { foreach (EventParameter parameter1 in values) { event1.AddProperty(parameter1.Name, parameter1.Value); } } event1.Sign(); } catch (Exception exception1) { ReportException(exception1); } }
public static EventSeverity Parse(string sArg, EventSeverity defaultEventSeverity) { if (sArg != null) { string text1 = sArg.ToUpper(); foreach (EventSeverity severity1 in AllPossiblePriorities) { if (severity1.ToString().ToUpper() == text1) { return severity1; } } } return defaultEventSeverity; }
public static EventSeverity Parse(int val, EventSeverity defaultEventSeverity) { int num1 = val; if (num1 <= 0x5dc0) { switch (num1) { case 0x4e20: return Info; case 0x5dc0: return Success; case 0: return Off; case 0x2710: return Trace; } return defaultEventSeverity; } if (num1 <= 0x8ca0) { switch (num1) { case 0x7530: return Warning; case 0x8ca0: return Failure; } return defaultEventSeverity; } switch (num1) { case 0x9c40: return Error; case 0xc350: return Fatal; } return defaultEventSeverity; }
protected BaseEvent(SerializationInfo info, StreamingContext context) { m_TimeStamp = DateTime.Now; m_Source = string.Empty; m_ThreadInfo = null; m_CallingMethod = null; m_StackDepth = 0; m_Message = string.Empty; m_Bag = new PropertyBag(); m_Severity = EventSeverity.Trace; m_EventID = 0; m_EventCategoryID = 0; m_TimeStamp = info.GetDateTime("timestamp"); m_Source = info.GetString("source"); m_ThreadInfo = info.GetString("threadinfo"); m_StackDepth = info.GetInt32("stackdepth"); m_Message = info.GetString("message"); m_WindowsIdentityName = info.GetString("windowsidentity"); m_EventID = info.GetInt32("eventid"); m_EventCategoryID = info.GetInt16("categoryid"); int num1 = info.GetInt32("severity"); m_Severity = EventSeverity.Parse(num1); int num2 = info.GetInt32("propcount"); for (int num3 = 0; num3 < num2; num3++) { string text1 = info.GetString("propname-" + num3.ToString()); string text2 = info.GetString("propvalue-" + num3.ToString()); m_Bag.Add(text1, text2); } }