utils.logging
utils.logging
Logging helpers to only log on main process.
Classes
| Name | Description |
|---|---|
| MultiProcessAdapter | Logger adapter for distributed logging, specifically to only log on main process. |
MultiProcessAdapter
utils.logging.MultiProcessAdapter()Logger adapter for distributed logging, specifically to only log on main process.
Methods
| Name | Description |
|---|---|
| warning_once | This method is identical to logger.warning(), but will emit the warning with the same message only once |
warning_once
utils.logging.MultiProcessAdapter.warning_once(*args, **kwargs)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 across the code. If they aren’t then need to switch to another type of cache that includes the caller frame information in the hashing function.