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

Function google2_log_prefix

tensorlayer/logging/tl_logging.py:209–241  ·  view source on GitHub ↗

Assemble a logline prefix using the google2 format.

(level, timestamp=None, file_and_line=None)

Source from the content-addressed store, hash-verified

207
208
209def google2_log_prefix(level, timestamp=None, file_and_line=None):
210 """Assemble a logline prefix using the google2 format."""
211 # pylint: disable=global-variable-not-assigned
212 global _level_names
213 # pylint: enable=global-variable-not-assigned
214
215 # Record current time
216 now = timestamp or _time.time()
217 now_tuple = _time.localtime(now)
218 now_microsecond = int(1e6 * (now % 1.0))
219
220 (filename, line) = file_and_line or _GetFileAndLine()
221 basename = _os.path.basename(filename)
222
223 # Severity string
224 severity = 'I'
225 if level in _level_names:
226 severity = _level_names[level][0]
227
228 s = '%c%02d%02d %02d: %02d: %02d.%06d %5d %s: %d] ' % (
229 severity,
230 now_tuple[1], # month
231 now_tuple[2], # day
232 now_tuple[3], # hour
233 now_tuple[4], # min
234 now_tuple[5], # sec
235 now_microsecond,
236 _get_thread_id(),
237 basename,
238 line
239 )
240
241 return s
242
243
244def get_verbosity():

Callers

nothing calls this directly

Calls 2

_GetFileAndLineFunction · 0.85
_get_thread_idFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…