static void writeLine(string message, TraceCategory category) { Trace.WriteLine(string.Format("{0} [{1}] [{2}] {3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff"), Thread.CurrentThread.ManagedThreadId, category.ToString(), message)); }
// TODO: strip this code in the end! public static void Info(TraceCategory category, string message) { if (!EnabledMask.HasFlag(category)) { return; } Debug.Log("[" + category.ToString() + "]" + message); }
private static void writeLine(string message, TraceCategory category) { #pragma warning disable 0618 Trace.WriteLine(string.Format("{0} [{3}] [{1}] {2}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff"), category.ToString(), message, AppDomain.GetCurrentThreadId())); #pragma warning restore 0618 }
private static EventSeverity GetCategoryDefaultEventSeverity(TraceCategory cat) { // Get the type Type type = cat.GetType(); // Get fieldinfo for this type System.Reflection.FieldInfo fieldInfo = type.GetField(cat.ToString()); // Get the stringvalue attributes DefaultEventSeverityAttribute[] attribs = fieldInfo.GetCustomAttributes(typeof(DefaultEventSeverityAttribute), false) as DefaultEventSeverityAttribute[]; // Return the first if there was a match. return(attribs.Length > 0 ? attribs[0].Severity : EventSeverity.Error); }
private static string GetCategoryName(TraceCategory cat) { // Get the type Type type = cat.GetType(); // Get fieldinfo for this type System.Reflection.FieldInfo fieldInfo = type.GetField(cat.ToString()); // Get the stringvalue attributes CategoryNameAttribute[] attribs = fieldInfo.GetCustomAttributes(typeof(CategoryNameAttribute), false) as CategoryNameAttribute[]; // Return the first if there was a match. return(attribs.Length > 0 ? attribs[0].Name : null); }
public SPDiagnosticsCategory this[TraceCategory id] { get { return(Areas[DiagnosticsAreaName].Categories[id.ToString()]); } }