-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
console.log({ a: string }) only prints 100 characters #22160
Comments
Guys... this is terrible. Only printing 100 characters of a string that you explicitly told the console to log is incomprehensibly bad. I have a question.. does ANYONE here actually support the idea of only printing 100 characters with console.log ? Please speak up if you do. I'd love to hear your reasoning. Please explain to me why I only deserve to see 100 characters of a string I just told the console to log. PLEASE explain this to me. Thank You. |
A max length is set to prevent large string output from being too overwhelming. I agree, let's update |
Here are screenshots of 1,000 and 10,000 characters. 1,000 takes up only a couple lines of terminal. 10,000 takes up a little bit more. At the very least I'd be happy with 1,000 which is about 10 times better than the current 100 characters! I'd probably take 10,000 too just to display all the information as default 1,000: 10,000: 100: |
Since you asked, I do find the default behaviour very nice.
Points (1) and (2) are to say that the current behaviour is easy to work around, and personally I never found the behaviour to be unexpected or even a surprise that logging objects may abbreviate textual content in properties.
Does it have all the properties I expect it to have? Do the property values and their types seem sane? Abbreviating long string values and arrays help a lot in visually scanning the output for any unexpected shapes. When it comes to strings, I'm generally looking for numbers that are actually strings, empty strings that might be interpreted as falsy and so on. Quite often I'm debugging objects in a loop to visually scan any outliers in the ouput, which further emphasizes the need for a conscise, easy to visually parse output format. For point 3, the current behaviour feels very well thought out, and I like it. Thing is, |
I have a lot of different code running, 10 terminals on a 4k monitor, all of them logging various things, very often objects with strings, and EVERY SINGLE TIME I have an object with string that I NEED TO SEE I get the dreaded "x more characters" message and I wonder what exactly these people were thinking to only allow 100 characters in a string. These people must not work with console output or do anything serious |
@e3dio You are violating our Code of Conduct:
@jtoppine provided meaningful answers to why "x more characters" is useful and logging full objects should use That said, we will accept PRs that bump the current default limit to |
I also experienced this issue right now. This is part of the object logged from a Luckily the search term "deno prevent console.log truncation" returned this issue as the second result! I'd really like to see the @littledivy I'm not sure what happened with the PRs, but it seems the newest opened one is ready to go? Oh, and I think having somewhat parity with Node.js's |
Version: Deno 1.40.2
Logging an object only prints the first 100 characters of any strings in the object. This default needs to be higher. I see there is Deno.inspect but I'd rather not call
console.log(Deno.inspect(value, { colors: true, strAbbreviateSize: 1000 }))
every time I need to log to console. Node.js displays 10,000 characters. 1,000 would be better than 100.The text was updated successfully, but these errors were encountered: