[ https://issues.apache.org/jira/browse/ARIA-138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15976427#comment-15976427 ]
ASF GitHub Bot commented on ARIA-138: ------------------------------------- Github user mxmrlv commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/104#discussion_r112410679 --- Diff: aria/cli/execution_logging.py --- @@ -14,53 +14,68 @@ # limitations under the License. import os +from StringIO import StringIO from . import logger from .env import env DEFAULT_FORMATTING = { - logger.NO_VERBOSE: {'main_msg': '{item.msg}'}, + logger.NO_VERBOSE: {'message': '{item.msg}'}, logger.LOW_VERBOSE: { - 'main_msg': '{created_at} | {item.level[0]} | {item.msg}', - 'created_at': '%H:%M:%S' - } + 'message': '{timestamp} | {item.level[0]} | {item.msg}', + 'timestamp': '%H:%M:%S' + }, + logger.MEDIUM_VERBOSE: { + 'message': '{timestamp} | {item.level[0]} | {item.msg} | {implementation}', + 'timestamp': '%H:%M:%S' + }, + logger.HIGH_VERBOSE: { + 'message': '{timestamp} | {item.level[0]} | {item.msg} | {implementation}({inputs})', + 'timestamp': '%H:%M:%S' + }, } -class load(object): +def _str(item, formatting=None): + # Only NO_VERBOSE and LOW_VERBOSE are configurable formats. configuring + # the low verbose level should affect any higher level. + formats = formatting or DEFAULT_FORMATTING + formatting = formats[env.logging.verbosity_level] + msg = StringIO() - def __init__(self, item, formats=None): - self._item = item - self._formats = formats or DEFAULT_FORMATTING + kwargs = dict(item=item) - def __repr__(self): - # Only NO_VERBOSE and LOW_VERBOSE are configurable formats. configuring - # the low verbose level should affect any higher level. - formats = self._formats[min(env.logging.verbosity_level, logger.LOW_VERBOSE)] + if item.task: + kwargs['implementation'] = item.task.implementation + kwargs['inputs'] = dict(i.unwrap() for i in item.task.inputs.values()) + else: + kwargs['implementation'] = item.execution.workflow_name + kwargs['inputs'] = dict(i.unwrap() for i in item.execution.inputs.values()) - kwargs = dict(item=self._item) - if 'created_at' in formats: - kwargs['created_at'] = self._item.created_at.strftime(formats['created_at']) - if 'level' in formats: - kwargs['level'] = formats['level'].format(self._item.level) - if 'msg' in formats: - kwargs['msg'] = formats['msg'].format(self._item.msg) + if 'timestamp' in formatting: + kwargs['timestamp'] = item.created_at.strftime(formatting['timestamp']) + else: + kwargs['timestamp'] = item.created_at - if 'actor' in formats and self._item.task: - kwargs['actor'] = formats['actor'].format(self._item.task.actor) - if 'execution' in formats: - kwargs['execution'] = formats['execution'].format(self._item.execution) + # If no format was supplied just print out the original msg. + msg.write(formatting.get('message', '{item.msg}').format(**kwargs)) --- End diff -- use default > CLI output verbosity levels > --------------------------- > > Key: ARIA-138 > URL: https://issues.apache.org/jira/browse/ARIA-138 > Project: AriaTosca > Issue Type: Story > Reporter: Maxim Orlov > Assignee: Maxim Orlov > > The CLI should support the display of the following logging levels: > default: execution logs: simple representation of executed operations > -v : execution logs: representation with time stamps and logging levels > -vv : execution logs: retrieve the stacktrace of any failed operation. > -vvv : all configured loggers should be set to {{debug}} level; any CLI > errors should be logged and printed with their stack trace as well. > (both the default and the first level of logging format should be > configurable). > Note that all of the operations logs should be saved in the storage. This > issue relates only to the way the logs are displayed in the CLI. -- This message was sent by Atlassian JIRA (v6.3.15#6346)