How can I get the last log made on the Debug console as a string?

I want to get the last log made on the console as a string variable. I am using this is solely for unity unit testing.

protected virtual void Start()
{
Application.logMessageReceived += Application_logMessageReceived;
}
string condition;
private void Application_logMessageReceived(string condition, string stackTrace, LogType type)
{
this.condition = condition;
}

    private void OnDestroy()
    {
        Debug.Log(condition);
    }

Ran this as a quick test. Seemed to re-output the last console message that I put into it.

See the example on this page: Application.logMessageReceived