How to intelligently auto-cycle ERRORLOG using T-SQL

In my previous post, I described different ways to read very large SQL Server Log (ERRORLOG) – 5GB to be exact. However, this was a reaction to something that has already happened. In this post, I will show you how to prevent this from happening at all.