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
(self, *args, **kwargs)
| 55 | |
| 56 | @functools.lru_cache(None) |
| 57 | def warning_once(self, *args, **kwargs): |
| 58 | """This method is identical to `logger.warning()`, but will emit the |
| 59 | warning with the same message only once. |
| 60 | |
| 61 | Note: The cache is for the function arguments, so 2 different callers using the same arguments will hit the |
| 62 | cache. The assumption here is that all warning messages are unique across the code. If they aren't then need to |
| 63 | switch to another type of cache that includes the caller frame information in the hashing function. |
| 64 | """ |
| 65 | self.warning(*args, **kwargs) |
| 66 | |
| 67 | |
| 68 | def get_logger(name: str, log_level: str = 'DEBUG'): |
nothing calls this directly
no outgoing calls
no test coverage detected