To support also logging objects: function log( m ) { console.log( ' '.repeat( new Error().stack.match(/\n/g).length - 2 ) + JSON.stringify(m,null,2) ) }
-
-
-
this is probably best: function log(format, ...args) { let indent = ' '.repeat(new Error().stack.match(/\n/g).length - 2); if (typeof format === 'string') { console.log(indent + format, ...args); } else { console.log(indent, format, ...args); } }
Kraj razgovora
Novi razgovor -
-
-
Default stack limit is 10 and it’s very easy to hit that limit with modern complex frameworks.
-
there's always Error.stackTraceLimit
Kraj razgovora
Novi razgovor -
-
-
What about useLog :D
-
you write it!
- Još 1 odgovor
Novi razgovor -
-
-
But... don’t you know that printing to the onsole is bad vs using the degugger??? This is cool :) love text logs!
-
using log statements to debug is definitely not bad!
- Još 4 druga odgovora
Novi razgovor -
-
-
Alternatively: use http://console.group () and console.groupEnd() to log collapsible nested statements.
-
- Još 1 odgovor
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.





eng manager at 
she/her. I'm trans!