MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / log_first_n

Function log_first_n

tensorlayer/logging/tl_logging.py:172–184  ·  view source on GitHub ↗

Log 'msg % args' at level 'level' only first 'n' times. Not threadsafe. Args: level: The level at which to log. msg: The message to be logged. n: The number of times this should be called before it is logged. *args: The args to be substituted into the msg.

(level, msg, n, *args)

Source from the content-addressed store, hash-verified

170
171
172def log_first_n(level, msg, n, *args): # pylint: disable=g-bad-name
173 """Log 'msg % args' at level 'level' only first 'n' times.
174
175 Not threadsafe.
176
177 Args:
178 level: The level at which to log.
179 msg: The message to be logged.
180 n: The number of times this should be called before it is logged.
181 *args: The args to be substituted into the msg.
182 """
183 count = _GetNextLogCountPerToken(_GetFileAndLine())
184 log_if(level, msg, count < n, *args)
185
186
187def log_if(level, msg, condition, *args):

Callers

nothing calls this directly

Calls 3

_GetNextLogCountPerTokenFunction · 0.85
_GetFileAndLineFunction · 0.85
log_ifFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…