Add log level info, update help texts
This commit is contained in:
parent
77fba71a8e
commit
246935bde6
5
index.js
5
index.js
@ -6,6 +6,11 @@ const configure = (conn, defaultConsole) => {
|
|||||||
if (console._tsconsole_configured) return;
|
if (console._tsconsole_configured) return;
|
||||||
console._tsconsole_configured = true;
|
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) => {
|
console.log = (...args) => {
|
||||||
sendWhenConnected(conn, JSON.stringify({ type: 'log', data: Array.from(args) , }), defaultConsole);
|
sendWhenConnected(conn, JSON.stringify({ type: 'log', data: Array.from(args) , }), defaultConsole);
|
||||||
defaultConsole.log.apply(defaultConsole, args);
|
defaultConsole.log.apply(defaultConsole, args);
|
||||||
|
@ -11,7 +11,7 @@ const CYellow = "\x1b[33m";
|
|||||||
const CWhite = "\x1b[37m";
|
const CWhite = "\x1b[37m";
|
||||||
const CBlue = "\x1b[34m";
|
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
|
// global var keeping track of what to display
|
||||||
let SHOWLEVELS = LOGLEVELS;
|
let SHOWLEVELS = LOGLEVELS;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ const startServer = (options) => {
|
|||||||
// Start a node repl
|
// Start a node repl
|
||||||
const r = repl.start({prompt: "> "});
|
const r = repl.start({prompt: "> "});
|
||||||
r.defineCommand('show', {
|
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) {
|
action(arg) {
|
||||||
const args = arg.split(",");
|
const args = arg.split(",");
|
||||||
applyShowFilter(args);
|
applyShowFilter(args);
|
||||||
@ -172,7 +172,7 @@ Options:
|
|||||||
Save output to file
|
Save output to file
|
||||||
|
|
||||||
--show args
|
--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 {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user