Object-Oriented Programming · Oracle · Medium
Build a small, extensible logging component. The main class, Logger, is constructed with a list of handler objects, and its log(message) method must send the given message through each of the handlers it was configured with. You also need to provide two concrete handlers: TruncateHandler, a handler that shortens the message. StoreHandler, a handler that keeps the message in a list it holds internally rather than printing it out. Example 1: Explanation: This is the usage…