HomePHP Expanding an Error Logger with the Chain of Responsibility Pattern
Expanding an Error Logger with the Chain of Responsibility Pattern
Do you want to know how to build an error logging system using the chain of responsibility schema with PHP? If your answer is a loud yes, then in this group of articles you’ll find what you’ve been looking for! Welcome to the concluding part of the series “Understanding the chain of responsibility between PHP objects.” This set of three tutorials shows you how to define a specific chain of responsibility that involves several PHP objects, and applies this concept to creating an expandable error logging mechanism.
After introducing you to the subject of this series, I'd like to step back quickly to the previous tutorial and recall the topics covered in it. This will make it a bit easier for you to grasp the concepts that I plan to explain in this final part.
As you'll possibly remember, in the previous article I went through the development of a comprehensive error logging system. It used the chain of responsibility pattern to establish the scope of where each involved PHP class should act.
By following this approach, it was feasible to create an error handling mechanism where every component was initially provided with a limited capacity for processing a particular failure -- and when the error in question couldn't be properly handled, it would be immediately transferred to the corresponding parent module.
Indeed, if you reread the above paragraph, it should be clear to you what a chain of responsibility is all about: once a group of hierarchically organized classes have been created, the responsibility for handling a given task is moved from the bottom to the top of the stack structure. Sounds good, doesn't it?
Now, paying attention to the topics that will be covered in this tutorial, what you'll learn here will consist essentially of applying the chain of responsibility schema to expand the capacity of the error logging system that was developed previously.
Are you intrigued about how this will done? Then click the link below and keep reading!