<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, string):
 """Erase newline from a string and write to the logger."""

        string = string.rstrip()
        if string:  # Don't log empty lines
            self.logger.critical(string)