improve logs output
This commit is contained in:
parent
1c59701045
commit
fd142ac2e6
|
@ -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})
|
||||
|
|
|
@ -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>'))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue