How to develop your own logger module for Shell Script
As we all know that there is no software application exist without any error or bug or issue in real time. Due to that fact, we all understand the utter most importance of logging of messages based on the events/execution logic for any software applications. Based on messages logging behavior, We are not only able to investigate for any error or bug or data issue but also identify the root cause to provide timely fix for erroneous logic within application. Most of the high languages provide LOGGER module to achieve this by integrating LOGGER module within application. Unfortunately Shell does not provide any logging module that has generic behavior to log messages specific to scripts however there is logger command that helps us to understand at system level what is going on but not in the context of script logic that is highly important to investigate errors/issues/bugs.
Understanding the importance of Logger module for shell, I have developed small logger module that can be used in similar way that other programming language has. Here is the my youtube video that explains How can you build your own LOGGER module
Once you are done building your own LOGGER module by following earlier given video link then you can follow along with this video which explains How to use LOGGER module within any other script.
By following above 2 videos, you will be having clear idea how can you implement logging for any script ready for production usage. Next step for you to just analyze this log based on the defined category in the context of reported error or issue or bug to find out actual root cause.
Please reach out to me if you face any issue in following along with above given video link….
As always stay healthy & keep learning….