I would like to start a series of blog posts titled “Better Know Sitecore” where I will cover those areas of the product
Today we are covering the “Sitecore.Diagnostics” namespace, specifically, the “Log” class which most of you used for logging.
Recently discovered method of this class “SingleError” can be used when you would like to log only one instance of a specific error, not more than that. For example, we used it when trying to get a template for an item. If a template is not found or invalid, we don’t want to output it more than once. Under the hood, there is a caching mechanism in place that checks if the same error message is already in the collection – skip it, otherwise call the “Error” method.
Thanks goes to Sergey