Skip to content

Commit

Permalink
fix: better logging of objects (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Dec 17, 2023
1 parent d9957c0 commit 5d02141
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mod.ts
Expand Up @@ -766,7 +766,14 @@ function build$FromState<TExtras extends ExtrasObject = {}>(state: $State<TExtra

function getLogText(data: any[]) {
// this should be smarter to better emulate how console.log/error work
const combinedText = data.join(" ");
const combinedText = data.map((d) => {
const typeofD = typeof d;
if (typeofD !== "object" && typeofD !== "undefined") {
return d;
} else {
return Deno.inspect(d, { colors: true });
}
}).join(" ");
if (state.indentLevel.value === 0) {
return combinedText;
} else {
Expand Down

0 comments on commit 5d02141

Please sign in to comment.