ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARIA-146) Support colorful execution logging
Date Tue, 25 Apr 2017 16:24:05 GMT

    [ https://issues.apache.org/jira/browse/ARIA-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15983163#comment-15983163
] 

ASF GitHub Bot commented on ARIA-146:
-------------------------------------

Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/109#discussion_r113234319
  
    --- Diff: aria/cli/execution_logging.py ---
    @@ -12,62 +12,208 @@
     # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     # See the License for the specific language governing permissions and
     # limitations under the License.
    -
    +import os
    +import re
     from StringIO import StringIO
    +from contextlib import contextmanager
     
     from . import logger
    +from .color import Color
     from .env import env
     
    +
    +LEVEL = 'level'
    +TIMESTAMP = 'timestamp'
    +MESSAGE = 'message'
    +IMPLEMENTATION = 'implementation'
    +INPUTS = 'inputs'
    +TRACEBACK = 'traceback'
    +MARKER = 'marker'
    +
    +FINAL_STATES = 'final_states'
    +SUCCESS_STATE = 'success'
    +CANCEL_STATE = 'cancel'
    +FAIL_STATE = 'fail'
    +
    +
    +_EXECUTION_BASE_PATTERN = "\'.*\' workflow execution "
    +_SUCCESSFUL_EXECUTION_PATTERN = _EXECUTION_BASE_PATTERN + "succeeded"
    +_FAILED_EXECUTION_PATTERN = _EXECUTION_BASE_PATTERN + "failed"
    +_CANCELED_EXECUTION_PATTERN = _EXECUTION_BASE_PATTERN + "canceled"
    +
     DEFAULT_FORMATTING = {
    -    logger.NO_VERBOSE: {'message': '{item.msg}'},
    +    logger.NO_VERBOSE: {'message': '{message}'},
         logger.LOW_VERBOSE: {
    -        'message': '{timestamp} | {item.level[0]} | {item.msg}',
    -        'timestamp': '%H:%M:%S'
    +        MESSAGE: '{timestamp} | {level} | {message}',
    +        LEVEL: '{level[0]}',
    +        TIMESTAMP: '%H:%M:%S',
         },
         logger.MEDIUM_VERBOSE: {
    -        'message': '{timestamp} | {item.level[0]} | {implementation} | {item.msg} ',
    -        'timestamp': '%H:%M:%S'
    +        MESSAGE: '{timestamp} | {level} | {implementation} | {message} ',
    +        LEVEL: '{level[0]}',
    +        TIMESTAMP: '%H:%M:%S'
         },
         logger.HIGH_VERBOSE: {
    -        'message': '{timestamp} | {item.level[0]} | {implementation}({inputs}) | {item.msg}
',
    -        'timestamp': '%H:%M:%S'
    +        MESSAGE: '{timestamp} | {level} | {implementation} | {inputs} | {message} ',
    +        LEVEL: '{level[0]}',
    +        TIMESTAMP: '%H:%M:%S'
    +    },
    +}
    +
    +DEFAULT_STYLING = {
    +    LEVEL: {
    +        'info': Color.Fore.LIGHTMAGENTA_EX,
    +        'debug': Color.Schema(fore=Color.Fore.LIGHTMAGENTA_EX, style=Color.Style.DIM),
    +        'error': Color.Schema(fore=Color.Fore.RED, style=Color.Style.BRIGHT),
         },
    +    TIMESTAMP: {
    +        'info': Color.Fore.LIGHTMAGENTA_EX,
    +        'debug': Color.Schema(fore=Color.Fore.LIGHTMAGENTA_EX, style=Color.Style.DIM),
    +        'error': Color.Schema(fore=Color.Fore.RED, style=Color.Style.BRIGHT),
    +    },
    +    MESSAGE: {
    +        'info': Color.Fore.LIGHTBLUE_EX,
    +        'debug': Color.Schema(fore=Color.Fore.LIGHTBLUE_EX, style=Color.Style.DIM),
    +        'error': Color.Schema(fore=Color.Fore.RED, style=Color.Style.BRIGHT),
    +    },
    +    IMPLEMENTATION: {
    +        'info': Color.Fore.LIGHTBLACK_EX,
    +        'debug': Color.Schema(fore=Color.Fore.LIGHTBLACK_EX, style=Color.Style.DIM),
    +        'error': Color.Schema(fore=Color.Fore.RED, style=Color.Style.BRIGHT),
    +    },
    +    INPUTS: {
    +        'info': Color.Fore.BLUE,
    +        'debug': Color.Schema(fore=Color.Fore.BLUE, style=Color.Style.DIM),
    +        'error': Color.Schema(fore=Color.Fore.RED, style=Color.Style.BRIGHT),
    +    },
    +    TRACEBACK: {'error': Color.Fore.RED},
    +
    +    MARKER: Color.Back.LIGHTYELLOW_EX,
    +    FINAL_STATES: {
    +        SUCCESS_STATE: Color.Fore.GREEN,
    +        CANCEL_STATE: Color.Fore.YELLOW,
    +        FAIL_STATE: Color.Fore.RED,
    +    }
     }
     
    +_PATTERNS = {
    +    SUCCESS_STATE: re.compile(_SUCCESSFUL_EXECUTION_PATTERN),
    +    CANCEL_STATE: re.compile(_CANCELED_EXECUTION_PATTERN),
    +    FAIL_STATE: re.compile(_FAILED_EXECUTION_PATTERN)
    +
    +}
    +
    +
    +class _StylizedLogs(object):
    +
    +    def __init__(self):
    +        self._formats = DEFAULT_FORMATTING
    +        self._styles = DEFAULT_STYLING
    +        self._mark_pattern = None
    +
    +    def _push(self, styles=None, formats=None, mark_pattern=None):
    --- End diff --
    
    remove


> Support colorful execution logging
> ----------------------------------
>
>                 Key: ARIA-146
>                 URL: https://issues.apache.org/jira/browse/ARIA-146
>             Project: AriaTosca
>          Issue Type: Story
>            Reporter: Ran Ziv
>            Assignee: Maxim Orlov
>            Priority: Minor
>
> Add support for printing execution logs in color



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message