Skip to content

Commit 1e3817f

Browse files
feat(cli): add --log-level flag and default log output to WARNING
1 parent 09dd517 commit 1e3817f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

hatch/cli/__main__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ def main() -> int:
972972
"""
973973
# Configure logging
974974
logging.basicConfig(
975-
level=logging.INFO,
975+
level=logging.WARNING,
976976
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
977977
)
978978

@@ -1010,8 +1010,15 @@ def main() -> int:
10101010
default=Path.home() / ".hatch" / "cache",
10111011
help="Directory to store cached packages",
10121012
)
1013+
parser.add_argument(
1014+
"--log-level",
1015+
default="WARNING",
1016+
choices=["DEBUG", "INFO", "WARNING", "ERROR"],
1017+
help="Log verbosity level (default: WARNING)",
1018+
)
10131019

10141020
args = parser.parse_args()
1021+
logging.getLogger().setLevel(getattr(logging, args.log_level))
10151022

10161023
# Initialize managers (lazy - only when needed)
10171024
from hatch.environment_manager import HatchEnvironmentManager

0 commit comments

Comments
 (0)