When rotating, rotate the current log. The default implementation calls the 'rotator' attribute of the handler, if it's callable, passing the source and dest arguments to it. If the attribute isn't callable (the default is None), the source is simply renamed
(self, source, dest)
| 102 | return result |
| 103 | |
| 104 | def rotate(self, source, dest): |
| 105 | """ |
| 106 | When rotating, rotate the current log. |
| 107 | |
| 108 | The default implementation calls the 'rotator' attribute of the |
| 109 | handler, if it's callable, passing the source and dest arguments to |
| 110 | it. If the attribute isn't callable (the default is None), the source |
| 111 | is simply renamed to the destination. |
| 112 | |
| 113 | :param source: The source filename. This is normally the base |
| 114 | filename, e.g. 'test.log' |
| 115 | :param dest: The destination filename. This is normally |
| 116 | what the source is rotated to, e.g. 'test.log.1'. |
| 117 | """ |
| 118 | if not callable(self.rotator): |
| 119 | # Issue 18940: A file may not have been created if delay is True. |
| 120 | if os.path.exists(source): |
| 121 | os.rename(source, dest) |
| 122 | else: |
| 123 | self.rotator(source, dest) |
| 124 | |
| 125 | class RotatingFileHandler(BaseRotatingHandler): |
| 126 | """ |