Custom Console in Application

I’m trying to make a ‘TextWindow’ that holds messages that the Application sends to it. The problem is that I have no idea on how to do this.
I want to do something like, in C#,

TextWindow.NewLine("This will be displayed in the TextWindow");

Would I just create a new script called “TextWindow” and set it up something like this?

using UnityEngine;
using System.Collections;

public class TextWindow : MonoBehaviour
{
	public TextWindow(Rect Size, string WindowName)
	{
		GUI.Box(new Rect(Size), WindowName);
	}
	
	public NewLine(string Text)
	{
		GUI.Label(new Rect(Rect), Text);
	}
	
}

Then call it using,

TextWindow tWindow = new TextWindow(Size);

Size of course being a Rect.

This is a basic concept on how I want it to look in the end.
15262-textwindowexample.gif

Because this is a console, and you will ever only need one, you should begin by making your console a static class.

The basic principle is simple: you have a ScrollView, a VerticalArea, FlexibleSpace and a List< string >. So something like:

public static class MyConsole{
    private static List< string > messages;
    private static Vector2 viewPoint;

    public static void DrawConsole(Rect area){
        GUILayout.BeginArea(area);
        viewPoint = GUILayout.BeginScrollView(viewPoint);
        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();
        //print each string in messages here
        //now close all the above areas
    }

    public static void NewMessage(string message){
        messages.Add(message);
        viewPoint = Vector2.one;
    }
}

Now, in an OnGUI, to draw this, you use MyConsole.DrawConsole(area); and to add messages, MyConsole.NewMessage(message);

If you, for some reason need multiple consoles/textwindows, the same idea applies, you just need to remove the static, and keep track of the references.