예제 #1
0
        private string FormatLine(string line, LogLevel level, Tag tag, string stackTrace)
        {
            RecyclableStringBuilder lineBuffer = StringBuilderPool.NextBuilder();

            string coloredLine = EditorSkin.SetColors(line);

            string filename = EditorStackTrace.ExtractFileName(stackTrace);

            if (level != null)
            {
                lineBuffer.Append("[");
                lineBuffer.Append(level.ShortName);
                lineBuffer.Append("]: ");
            }

            if (filename != null)
            {
                lineBuffer.Append(StringUtils.C("[" + filename + "]: ", EditorSkin.GetColor(ColorCode.Plain)));
            }

            if (tag != null)
            {
                lineBuffer.Append("[");
                lineBuffer.Append(tag.Name);
                lineBuffer.Append("]: ");
            }

            lineBuffer.Append(coloredLine);

            string result = lineBuffer.ToString();

            lineBuffer.Recycle(); // don't trash timer manager with this call

            return(result);
        }