From 246935bde6cc3da2a0c873b3c902f08cabcafa43 Mon Sep 17 00:00:00 2001 From: Philipp Dieter Date: Sat, 28 Aug 2021 18:14:47 +0200 Subject: [PATCH] Add log level info, update help texts --- index.js | 5 +++++ server.js | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index c7dae01..93f731b 100755 --- a/index.js +++ b/index.js @@ -6,6 +6,11 @@ const configure = (conn, defaultConsole) => { if (console._tsconsole_configured) return; console._tsconsole_configured = true; + console.info = (...args) => { + sendWhenConnected(conn, JSON.stringify({ type: 'info', data: Array.from(args) , }), defaultConsole); + defaultConsole.info.apply(defaultConsole, args); + }; + console.log = (...args) => { sendWhenConnected(conn, JSON.stringify({ type: 'log', data: Array.from(args) , }), defaultConsole); defaultConsole.log.apply(defaultConsole, args); diff --git a/server.js b/server.js index f8cbb1a..456ec1e 100755 --- a/server.js +++ b/server.js @@ -11,7 +11,7 @@ const CYellow = "\x1b[33m"; const CWhite = "\x1b[37m"; const CBlue = "\x1b[34m"; -const LOGLEVELS = ['log', 'warn', 'error', 'debug']; +const LOGLEVELS = ['info', 'log', 'warn', 'error', 'debug']; // global var keeping track of what to display let SHOWLEVELS = LOGLEVELS; @@ -137,7 +137,7 @@ const startServer = (options) => { // Start a node repl const r = repl.start({prompt: "> "}); r.defineCommand('show', { - help: '[TERMLOG] Select log levels to display (info | warning | error | debug). Multiple levels are seperated by `,`', + help: '[TERMLOG] Select log levels to display (info | log | warning | error | debug). Multiple levels are seperated by `,`', action(arg) { const args = arg.split(","); applyShowFilter(args); @@ -172,7 +172,7 @@ Options: Save output to file --show args - Select log levels to display (info | warning | error | debug). Multiple levels are seperated by \`,\` + Select log levels to display (info | log | warning | error | debug). Multiple levels are seperated by \`,\` `); } else {