This method is identical to `logger.warning()`, but will emit the warning with the same message only once Note: The cache is for the function arguments, so 2 different callers using the same arguments will hit the cache. The assumption here is that all warning messages are unique acros
(*args, **kwargs)
| 63 | |
| 64 | @functools.lru_cache(None) |
| 65 | def warning_once(*args, **kwargs): |
| 66 | """ |
| 67 | This method is identical to `logger.warning()`, but will emit the warning with the same message only once |
| 68 | |
| 69 | Note: The cache is for the function arguments, so 2 different callers using the same arguments will hit the cache. |
| 70 | The assumption here is that all warning messages are unique across the code. If they aren't then need to switch to |
| 71 | another type of cache that includes the caller frame information in the hashing function. |
| 72 | """ |
| 73 | logger.warning(*args, **kwargs) |
| 74 | |
| 75 | |
| 76 | logger.warning_once = warning_once |
no test coverage detected