Log certain message only once. Call this function more than one times with the same message will result in no-op. Args: message(str): message to log func(str): the name of the logger method. e.g. "info", "warn", "error".
(message, func='info')
| 127 | |
| 128 | @memoized |
| 129 | def log_once(message, func='info'): |
| 130 | """ |
| 131 | Log certain message only once. Call this function more than one times with |
| 132 | the same message will result in no-op. |
| 133 | |
| 134 | Args: |
| 135 | message(str): message to log |
| 136 | func(str): the name of the logger method. e.g. "info", "warn", "error". |
| 137 | """ |
| 138 | getattr(logger, func)(message) |
| 139 | |
| 140 | |
| 141 | def call_only_once(func): |
no outgoing calls
no test coverage detected