示例#1
0
 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));
 }
示例#2
0
    // 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);
    }
示例#3
0
        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
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
 public SPDiagnosticsCategory this[TraceCategory id]
 {
     get { return(Areas[DiagnosticsAreaName].Categories[id.ToString()]); }
 }