From fd142ac2e6ee8a9b3f4d6e85d401bbf1bc4c07c6 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 12 Oct 2018 21:47:11 -0400 Subject: [PATCH] improve logs output --- embark-ui/src/actions/index.js | 3 ++- embark-ui/src/utils/utils.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/embark-ui/src/actions/index.js b/embark-ui/src/actions/index.js index 70a21173..99c4f7a4 100644 --- a/embark-ui/src/actions/index.js +++ b/embark-ui/src/actions/index.js @@ -1,4 +1,5 @@ import {EMBARK_PROCESS_NAME} from '../constants'; +import {ansiToHtml} from '../utils/utils'; export const REQUEST = 'REQUEST'; export const SUCCESS = 'SUCCESS'; @@ -99,7 +100,7 @@ export const commands = { return action(COMMANDS[SUCCESS], {processLogs: [{ timestamp: new Date().getTime(), name: EMBARK_PROCESS_NAME, - msg: `${payload.command} > ${command.result}` + msg: `console> ${payload.command}
${ansiToHtml(command.result)}` }]}) }, failure: (error) => action(COMMANDS[FAILURE], {error}) diff --git a/embark-ui/src/utils/utils.js b/embark-ui/src/utils/utils.js index 86fb7b95..4e71c95f 100644 --- a/embark-ui/src/utils/utils.js +++ b/embark-ui/src/utils/utils.js @@ -12,3 +12,9 @@ export function hashCode(str) { } return hash; } + +export function ansiToHtml(text) { + const Convert = require('ansi-to-html'); + const convert = new Convert(); + return convert.toHtml(text.replace(/\n/g,'
')) +}