Add TORCH_LOGS_FORMAT=short alias (#120757)
Shorthand for `"%(levelname)s:%(name)s:%(message)s"` which is hard to
remember.
I find the default formatter annoying since just the metadata fills up
most of the width of my terminal.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/120757
Approved by: https://github.com/ezyang
diff --git a/torch/_logging/_internal.py b/torch/_logging/_internal.py
index 3629725..6cf70d1 100644
--- a/torch/_logging/_internal.py
+++ b/torch/_logging/_internal.py
@@ -792,6 +792,8 @@
if fmt is None:
return TorchLogsFormatter()
else:
+ if fmt in ("short", "basic"):
+ fmt = logging.BASIC_FORMAT
return logging.Formatter(fmt)