Writes the given text verbatim into the log file (if any) and/or standard input (if the verbose flag is turned on). Used internally. @type text: str @param text: Text to print.
(self, text)
| 1783 | self.fd = None |
| 1784 | |
| 1785 | def __do_log(self, text): |
| 1786 | """ |
| 1787 | Writes the given text verbatim into the log file (if any) |
| 1788 | and/or standard input (if the verbose flag is turned on). |
| 1789 | |
| 1790 | Used internally. |
| 1791 | |
| 1792 | @type text: str |
| 1793 | @param text: Text to print. |
| 1794 | """ |
| 1795 | if isinstance(text, compat.unicode): |
| 1796 | text = text.encode("cp1252") |
| 1797 | if self.verbose: |
| 1798 | print(text) |
| 1799 | if self.logfile: |
| 1800 | try: |
| 1801 | self.fd.writelines("%s\n" % text) |
| 1802 | except IOError: |
| 1803 | e = sys.exc_info()[1] |
| 1804 | self.__logfile_error(e) |
| 1805 | |
| 1806 | def log_text(self, text): |
| 1807 | """ |
no test coverage detected