MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / warning_once

Method warning_once

parallel/logging.py:57–65  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
68def get_logger(name: str, log_level: str = 'DEBUG'):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected