Example #1
0
        /// <summary>
        /// Logs the command, adding it to the log history and triggers an event
        /// </summary>
        /// <param name="command"></param>
        /// <param name="color"></param>
        private static void LogCommand(string command, string color)
        {
            DebugLogItem item = new DebugLogItem(command, color, Time.frameCount, Time.time, 3, true);

            LogHistory.Add(item);
            MMDebugLogEvent.Trigger(new DebugLogItem(null, "", Time.frameCount, Time.time, 0, false));
        }
Example #2
0
        /// <summary>
        /// Outputs the message object to the console, prefixed with the current timestamp
        /// </summary>
        /// <param name="message">Message.</param>
        public static void DebugLogTime(object message, string color = "", int timePrecision = 3, bool displayFrameCount = true)
        {
            if (!DebugLogsEnabled)
            {
                return;
            }

            string callerObjectName = new StackTrace().GetFrame(1).GetMethod().ReflectedType.Name;

            color = (color == "") ? "#00FFFF" : color;

            // colors
            string colorPrefix = "";
            string colorSuffix = "";

            if (!string.IsNullOrEmpty(color))
            {
                colorPrefix = "<color=" + color + ">";
                colorSuffix = "</color>";
            }

            // build output
            string output = "";

            if (displayFrameCount)
            {
                output += "<color=#82d3f9>[f" + Time.frameCount + "]</color> ";
            }
            output += "<color=#f9a682>[" + MMTime.FloatToTimeString(Time.time, false, true, true, true) + "]</color> ";
            output += callerObjectName + " : ";
            output += colorPrefix + message + colorSuffix;

            // we output to the console
            Debug.Log(output);

            DebugLogItem item = new DebugLogItem(message, color, Time.frameCount, Time.time, timePrecision, displayFrameCount);

            // we add to our DebugLog
            if (LogHistory.Count > _logHistoryMaxLength)
            {
                LogHistory.RemoveAt(0);
            }

            LogHistory.Add(item);

            // we trigger an event
            MMDebugLogEvent.Trigger(item);
        }
Example #3
0
 /// <summary>
 /// Clears the debug log
 /// </summary>
 public static void DebugLogClear()
 {
     LogHistory.Clear();
     MMDebugLogEvent.Trigger(new DebugLogItem(null, "", Time.frameCount, Time.time, 0, false));
 }