Emit a warning log with the same message only once. This function is added as a method to the logging.Logger class. It emits a warning log with the same message only once, even if it is called multiple times with the same message. Args: *args: The arguments to pass to
(self, *args, **kwargs)
| 213 | |
| 214 | @lru_cache(None) |
| 215 | def warning_once(self, *args, **kwargs): |
| 216 | """ |
| 217 | Emit a warning log with the same message only once. |
| 218 | |
| 219 | This function is added as a method to the logging.Logger class. |
| 220 | It emits a warning log with the same message only once, |
| 221 | even if it is called multiple times with the same message. |
| 222 | |
| 223 | Args: |
| 224 | *args: The arguments to pass to the logging.Logger.warning method. |
| 225 | **kwargs: The keyword arguments to pass to the logging.Logger.warning method. |
| 226 | """ |
| 227 | self.warning(*args, **kwargs) |
| 228 | |
| 229 | |
| 230 | logging.Logger.warning_once = warning_once |