diff options
Diffstat (limited to 'cli/rt/02_console.js')
-rw-r--r-- | cli/rt/02_console.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/cli/rt/02_console.js b/cli/rt/02_console.js index 0eb7f0aac..bb2b6ea41 100644 --- a/cli/rt/02_console.js +++ b/cli/rt/02_console.js @@ -1425,10 +1425,12 @@ const timerMap = new Map(); const isConsoleInstance = Symbol("isConsoleInstance"); - const CONSOLE_INSPECT_OPTIONS = { - ...DEFAULT_INSPECT_OPTIONS, - colors: true, - }; + function getConsoleInspectOptions() { + return { + ...DEFAULT_INSPECT_OPTIONS, + colors: !(globalThis.Deno?.noColor ?? false), + }; + } class Console { #printFunc = null; @@ -1451,7 +1453,7 @@ log = (...args) => { this.#printFunc( inspectArgs(args, { - ...CONSOLE_INSPECT_OPTIONS, + ...getConsoleInspectOptions(), indentLevel: this.indentLevel, }) + "\n", false, @@ -1463,7 +1465,8 @@ dir = (obj, options = {}) => { this.#printFunc( - inspectArgs([obj], { ...CONSOLE_INSPECT_OPTIONS, ...options }) + "\n", + inspectArgs([obj], { ...getConsoleInspectOptions(), ...options }) + + "\n", false, ); }; @@ -1473,7 +1476,7 @@ warn = (...args) => { this.#printFunc( inspectArgs(args, { - ...CONSOLE_INSPECT_OPTIONS, + ...getConsoleInspectOptions(), indentLevel: this.indentLevel, }) + "\n", true, @@ -1679,7 +1682,7 @@ trace = (...args) => { const message = inspectArgs( args, - { ...CONSOLE_INSPECT_OPTIONS, indentLevel: 0 }, + { ...getConsoleInspectOptions(), indentLevel: 0 }, ); const err = { name: "Trace", |