Skip to content

Commit

Permalink
Slighly shorter colorLog()
Browse files Browse the repository at this point in the history
  • Loading branch information
colin273 committed Apr 21, 2022
1 parent 28fc9b7 commit ce30a16
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ let isPrompting = false;

// Utility functions for more visually pleasing logs
const colorLog = (data, source, color) => {
if (isPrompting) {
console.log(); // get out of user input area
}
console.log(color(`[${source}] `) + data);
// Get out of user input area if prompt is currently being shown
// Then log
console.log((isPrompting ? "\n" : "") + color(`[${source}] `) + data);
}

const debuggerLog = (data) => colorLog(data, "Debugger", blue);
Expand Down

0 comments on commit ce30a16

Please sign in to comment.