MCPcopy
hub / github.com/huggingface/transformers / enable_explicit_format

Function enable_explicit_format

src/transformers/utils/logging.py:290–302  ·  view source on GitHub ↗

Enable explicit formatting for every HuggingFace Transformers's logger. The explicit formatter is as follows: ``` [LEVELNAME|FILENAME|LINE NUMBER] TIME >> MESSAGE ``` All handlers currently bound to the root logger are affected by this method.

()

Source from the content-addressed store, hash-verified

288
289
290def enable_explicit_format() -> None:
291 """
292 Enable explicit formatting for every HuggingFace Transformers's logger. The explicit formatter is as follows:
293 ```
294 [LEVELNAME|FILENAME|LINE NUMBER] TIME >> MESSAGE
295 ```
296 All handlers currently bound to the root logger are affected by this method.
297 """
298 handlers = _get_library_root_logger().handlers
299
300 for handler in handlers:
301 formatter = logging.Formatter("[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s")
302 handler.setFormatter(formatter)
303
304
305def reset_format() -> None:

Callers

nothing calls this directly

Calls 2

_get_library_root_loggerFunction · 0.85
setFormatterMethod · 0.80

Tested by

no test coverage detected