Exemple #1
0
    static Logger GetLoggerByType(LogFilter type)
    {
        if (loggers.ContainsKey(type))
        {
            return(loggers[type]);
        }

        string typeString = type.ToString();

        int index = 1;

        for (; index < typeString.Length - 1; ++index)
        {
            if (char.IsUpper(typeString[index]))
            {
                break;
            }
        }

        typeString = typeString.Substring(0, index);
        if (typeString.IsEmpty())
        {
            return(null);
        }

        LogFilter parentLogger;

        if (!Enum.TryParse(typeString, out parentLogger))
        {
            return(null);
        }

        return(GetLoggerByType(parentLogger));
    }
Exemple #2
0
 public static void Out(LogFilter filter, string str)
 {
     log.Info(filter.ToString() + ": " + str);
     //if(ConsoleLogging.Get != null )
     //{
     //    ConsoleLogging.Get.Print(filter, str);
     //}
 }
Exemple #3
0
 public static void Out(LogFilter filter, Func <bool> filterCondition, string message)
 {
     if (filterCondition != null)
     {
         if (filterCondition())
         {
             log.Info(filter.ToString() + ": " + message);
             //if(ConsoleLogging.Get != null)
             //{
             //    ConsoleLogging.Get.Print(filter, message);
             //}
         }
     }
 }
    /// <summary>
    /// Prints the message on your console if the LogFilter is enabled on your machine AND if the registered Custom Filters on your machine contain customFilter.
    /// </summary>
    /// <param name="message"></param>
    /// <param name="filter"></param>
    /// <param name="customFilter"></param>
    public static void Log(string message, LogFilter filter, string customFilter)
    {
#if UNITY_EDITOR
        if (EditorPrefs.GetBool("SmartDebugIsEnabled") && EditorPrefs.GetBool("SmartDebug" + filter.ToString()))
        {
            Log(message, customFilter);
        }
#endif
    }