|
|
@ -14,7 +14,7 @@ export default class Logger extends EventEmitter { |
|
|
|
// readyState
|
|
|
|
this.building = false; |
|
|
|
|
|
|
|
this.socket = io(`https://io.now.sh?host=${host}`); |
|
|
|
this.socket = io(`https://io.now.sh?host=${host}&v=2`); |
|
|
|
this.socket.once('error', this.onSocketError.bind(this)); |
|
|
|
this.socket.on('state', this.onState.bind(this)); |
|
|
|
this.socket.on('logs', this.onLog.bind(this)); |
|
|
@ -56,18 +56,20 @@ export default class Logger extends EventEmitter { |
|
|
|
|
|
|
|
if (this.quiet) return; |
|
|
|
|
|
|
|
const data = log.object ? JSON.stringify(log.object) : log.text; |
|
|
|
|
|
|
|
if ('command' === log.type) { |
|
|
|
console.log(`${chalk.gray('>')} ▲ ${log.data}`); |
|
|
|
console.log(`${chalk.gray('>')} ▲ ${data}`); |
|
|
|
this.lines.reset(); |
|
|
|
} else if ('stderr' === log.type) { |
|
|
|
log.data.split('\n').forEach((v) => { |
|
|
|
data.split('\n').forEach((v) => { |
|
|
|
if (v.length) { |
|
|
|
console.error(chalk.red(`> ${v}`)); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.lines.reset(); |
|
|
|
} else if ('stdout' === log.type) { |
|
|
|
log.data.split('\n').forEach((v) => { |
|
|
|
data.split('\n').forEach((v) => { |
|
|
|
if (v.length) { |
|
|
|
this.lines.write(`${chalk.gray('>')} ${v}`); |
|
|
|
} |
|
|
|