Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9123814
D1463.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D1463.id.diff
View Options
diff --git a/swh/core/cli/__init__.py b/swh/core/cli/__init__.py
--- a/swh/core/cli/__init__.py
+++ b/swh/core/cli/__init__.py
@@ -7,23 +7,25 @@
import logging
import pkg_resources
-logger = logging.getLogger(__name__)
-
+LOG_LEVEL_NAMES = ['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
+logger = logging.getLogger(__name__)
+
@click.group(context_settings=CONTEXT_SETTINGS)
@click.option('--log-level', '-l', default='INFO',
- type=click.Choice(logging._nameToLevel.keys()),
+ type=click.Choice(LOG_LEVEL_NAMES),
help="Log level (default to INFO)")
@click.pass_context
def swh(ctx, log_level):
- """Software Heritage Tool
+ """Command line interface for Software Heritage
"""
+ log_level = logging.getLevelName(log_level)
logger.setLevel(log_level)
ctx.ensure_object(dict)
- ctx.obj['log_level'] = logging._nameToLevel[log_level]
+ ctx.obj['log_level'] = log_level
def main():
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 20, 6:10 PM (2 w, 14 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221003
Attached To
D1463: cli: Some cleanup and add missing options in db-init
Event Timeline
Log In to Comment