improve logs output

This commit is contained in:
Iuri Matias 2018-10-12 21:47:11 -04:00 committed by Pascal Precht
parent 1c59701045
commit fd142ac2e6
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 8 additions and 1 deletions

View File

@ -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}<br>${ansiToHtml(command.result)}`
}]})
},
failure: (error) => action(COMMANDS[FAILURE], {error})

View File

@ -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,'<br>'))
}