Example #1
0
        /// <summary>
        /// Write this instance.
        /// </summary>
        public void Write()
        {
            string OutStr        = "";
            string StartGroupTag = "<color=" + DebugGroup.ColorToHex(GroupIn.GroupColor) + "> ";
            string StartDebugTag = "<color=" + DebugGroup.ColorToHex(GroupIn.DebugColor) + "> ";
            string EndTag        = " </color> ";

            TreatedText = StartDebugTag + RawText.Replace("\n", EndTag + "\n" + StartDebugTag) + EndTag;

            OutStr += StartGroupTag + "[" + GroupIn.Name + "]" + EndTag + ":" + TreatedText;

            if (Debugatron.Settings.EnableTimestamp)
            {
                string StartTagTimestampColor = "<color=" + DebugGroup.ColorToHex(Debugatron.Settings.TimestampColor) + ">";

                if (Debugatron.Settings.TimestampBeginning)
                {
                    OutStr = CreateTimeStamp() + OutStr;
                }
                else
                {
                    OutStr += "\n " + StartTagTimestampColor + CreateTimeStamp() + EndTag + "\n";
                }
            }

            //Dispatch string to external handlers
            if (GroupIn.Externalize)
            {
                if (Debugatron.ExternalHandlers != null && Debugatron.ExternalHandlers.Count > 0)
                {
                    for (int i = 0; i < Debugatron.ExternalHandlers.Count; i++)
                    {
                        if (Debugatron.ExternalHandlers[i] == null)
                        {
                            Debugatron.ExternalHandlers.RemoveAt(i);
                            i--;
                            continue;
                        }
                        IExternalDebugatronOutputHandler Handler = Debugatron.ExternalHandlers[i];
                        Handler.HandleDebugatronString(OutStr);
                    }
                }
            }

            Debug.Log(OutStr);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DebugatronCore.DebugObj"/> class.
 /// </summary>
 /// <param name='Group'>
 /// DebugGroup it should belong to.
 /// </param>
 /// <param name='str'>
 /// Body of the log.
 /// </param>
 public DebugObj(DebugGroup Group, string str)
 {
     RawText     = str;
     GroupIn     = Group;
     TimeCreated = DateTime.UtcNow;
 }