Chain-of-responsibility pattern: Difference between revisions

Content deleted Content added
m Correctly placed method comments for EmailLogger and FileLogger methods INSIDE the method definition (just like other methods in the python snippet)
Line 432:
 
class EmailLogger(Logger):
"""Overrides parent's abstract method to send an email.
 
Arguments:
msg (str): Message string.
"""
def write_message(self, msg: str) -> None:
"""Overrides parent's abstract method to send an email.
 
Arguments:
msg (str): Message string.
"""
print(f"Sending via email: {msg}")
 
class FileLogger(Logger):
"""Overrides parent's abstract method to write a file.
 
Arguments:
msg (str): Message string.
"""
def write_message(self, msg: str) -> None:
"""Overrides parent's abstract method to write a file.
 
Arguments:
msg (str): Message string.
"""
print(f"Writing to log file: {msg}")