DEV Community

Discussion on: Good Bye console.log,no console.log in 2022

Collapse
 
imshivanshpatel profile image
Info Comment hidden by post author - thread only visible in this permalink
SHIVANSH PATEL

All your concerns are addressed and latest update is released. please tell me why are u overhyping console.log, console.log is just a wrapper

Console.prototype.log = function() {
  this._stdout.write(util.format.apply(this, arguments) + '\n');
};
Enter fullscreen mode Exit fullscreen mode
Collapse
 
deathshadow60 profile image
Info Comment hidden by post author - thread only visible in this permalink
deathshadow60 • Edited

I think @inhuofficial is thinking about it in terms of a browser console or tools inside something like Electron. If you were to use your system for client-side code you effectively remove a LOT of the extras provided by the console commands.

Like the ability to filter by type. Where's the link to the filename and line of code the console was called from? You're doing the message, but you're omitting a bunch of very useful features, both client-side and server-side.

Your goofy hard to read colours aren't doing any favors if we don't know what file, function, line, and character offset in the line the report was done from!

Sorry about the "goofy' part. System colours often fail accessibility minimums, and on the whole I'm not a fan of ever-shifting colours. Thus my intense dislike for the illegible acid trip that is colour syntax highlighting. My attitude towards coloured code is basically:

🎵Hate is a strong word, but I really really really don't like you🎵

Jokes aside, without the back-reference or a backtrace or anything else to tell you where the log/warn/error came from, this is as InHu said, somewhat crippled and a step backwards from the native methods.

But what do I know? I have this in several of my codebases because I find console.error to be "incomplete and crippled"

     libError = (routine, message, ...data) => {
            console.log(
                libraryName,
                " - Error reported by ",
                routine, 
                "\r\nbacktrace:"
            );
            console.trace();
            throw new Error(message);
        }; // libError

Because if it's an error, that **** should stop dead in its tracks, not blindly plod on like nothing is wrong!

Some comments have been hidden by the post's author - find out more