mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:31:33 +00:00
Allow switching between stdout and stderr logs in config.ts
This commit is contained in:
parent
0aa67b25aa
commit
1b8a36331c
@ -40,7 +40,7 @@ export const config = {
|
||||
console: {
|
||||
route: 'console',
|
||||
defaultContent: '',
|
||||
rewriteContentWithNewLogs: true
|
||||
rewriteContentWithNewLogs: 'stdout'
|
||||
},
|
||||
testmessenger: {
|
||||
route: 'testmessenger'
|
||||
|
@ -13,6 +13,7 @@ import { config } from '../config';
|
||||
})
|
||||
export class ConsoleComponent implements OnInit {
|
||||
console_content: string = config.console.defaultContent;
|
||||
rewriteContentWithNewLogs: string = config.console.rewriteContentWithNewLogs;
|
||||
|
||||
command_handlers = {
|
||||
'write': this.writeHandler.bind(this),
|
||||
@ -36,9 +37,12 @@ export class ConsoleComponent implements OnInit {
|
||||
this.sendContent(this.console_content);
|
||||
}
|
||||
|
||||
newLogHandler(content: string) {
|
||||
if (config.console.rewriteContentWithNewLogs) {
|
||||
this.setContent(content);
|
||||
newLogHandler(logs: any) {
|
||||
if (this.rewriteContentWithNewLogs !== '') {
|
||||
const log = logs[this.rewriteContentWithNewLogs];
|
||||
if (log) {
|
||||
this.setContent(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
this.selectedTerminalMenuItem = item;
|
||||
}
|
||||
|
||||
setConsoleContent(content: string) {
|
||||
this.childConsole.newLogHandler(content);
|
||||
setConsoleContent(logs: any) {
|
||||
this.childConsole.newLogHandler(logs);
|
||||
if (config.ide.showConsoleOnDeploy) {
|
||||
this.selectTerminalMenuItem('console');
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ export class IdeComponent implements OnInit {
|
||||
language: string = config.ide.defaultLanguage;
|
||||
theme = 'cobalt';
|
||||
|
||||
@Output() newLog = new EventEmitter<string>();
|
||||
@Output() newLog = new EventEmitter<any>();
|
||||
|
||||
options: any = {enableBasicAutocompletion: true,
|
||||
enableSnippets: true,
|
||||
@ -101,7 +101,10 @@ export class IdeComponent implements OnInit {
|
||||
config.ide.deployProcessName,
|
||||
(event) => {
|
||||
this.deploymentNotificationService.deploying.next(false);
|
||||
this.newLog.emit(event.data.log);
|
||||
this.newLog.emit({
|
||||
stdout: event.data.stdout,
|
||||
stderr: event.data.stderr
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -5,5 +5,6 @@ export class ProcessCommand {
|
||||
command: string;
|
||||
process_name: string;
|
||||
error?: string;
|
||||
log: string;
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user