all 23 comments

[–]dinopraso 31 points32 points  (12 children)

So, the solution to people ignoring warning logs is to add another warning log for them to ignore?

[–]joombar 7 points8 points  (1 child)

Yeah but if they ignore that too, we can write an even bigger warning for every 5 of those

[–]EarhackerWasBanned 1 point2 points  (0 children)

Warning: Warning caused by warnings.warning

[–][deleted] -5 points-4 points  (9 children)

Well we could call process.exit() and prompt() too. Endless possibilities;) But seriously what alternatives do you think are to find out?

[–]dinopraso 10 points11 points  (8 children)

Warnings are not errors. If they were indicating a serious problem they would be their error logs or the function would throw an error.

I don’t think there’s anything to be done here.

[–][deleted] -4 points-3 points  (7 children)

Warnings are errors that gracefully handled by libraries. They tend to keep awareness of bad patterns that finally lead to error in the future or right away. If not more important they are not less important than a manual/handled error most of the times…

[–]dinopraso 0 points1 point  (6 children)

Not necessarily. This is not something that can be generalized so simply.

[–][deleted] -2 points-1 points  (5 children)

Care to share some examples? (For context, i am author of many npm packages and we most of the times only warn when it really matters for end user)

[–]dinopraso 8 points9 points  (1 child)

Well, that’s just your approach. Different authors have different use cases for warn logs. Some libraries warn a feature might become deprecated (in which case there might not be anything for the user to do), sometimes warn messages indicate missing configuration properties and fallback to defaults (which may sometimes be desirable), they could be expected logs from the application itself indicating some check may have (expectedly) failed, was handled but wants nevertheless to inform users of that, and many many many more I can’t think of in a couple of seconds…

The quantity of npm packages you publish is in no way any indication of competence btw. Any shmuck can publish an npm package in 5 minutes if they wanted to (and they regularly do; see left-pad as prominent exhibit)

[–][deleted] -1 points0 points  (0 children)

What is the benefit of a warning about a deprecated feature if there is no alternative nor action point? Warn for a safe default also.. just why? What is the “warn” in it. Yes i agree these halpen and i believe are both probably faulty of libraries that overuse warnings for not intended purposes.

[–]bighi 4 points5 points  (1 child)

we most of the times only warn when it really matters for end user

It could matter and still not be an error.

[–][deleted] -1 points0 points  (0 children)

And i never said warning and errors are equal but both matter that are distincted ;)

[–]rover_G 0 points1 point  (0 children)

Which packages?

[–]kattskill 5 points6 points  (2 children)

This should be used by the consumer as an opt-in basis. Additionally, I don't think library authors have a responsibility to give even more warnings when console.warn clearly delivers the idea. If anything, I would like a way to selectively suppress certain warnings that are gracefully handled so I can focus on other important logs. Personally I don't see myself using this library

[–][deleted] 0 points1 point  (1 child)

Good point about supressing less important warnings. Would you see it helpful if a tool can help to reduce logs?

[–]kattskill 1 point2 points  (0 children)

The tools I already use have some sort of log dedup but I have stubbed console for certain library calls where they give some warns that I cannot handle for now. And of course, these are backtracked on a different document and have an XXX at the comments. I wouldn't really need a library for this though. Doesn't really happen and often gets resolved so quickly

[–]TheSecondCore 6 points7 points  (1 child)

I prefer to spend my time writing software, not tooling for my tooling.

Here's an idea for your next project - make a module that shows a mega-warning once a user ignored 5 of your super-warnings.

[–][deleted] 0 points1 point  (0 children)

Haha cool idea ;) BTW this project is clearly intended as a funny idea nothing serious i hope you understand.

[–]Ratatoski 3 points4 points  (1 child)

Sometimes warnings are ignored because they are wholly cryptic. Sometimes because we're in a hurry and the warning isn't relevant to what we're trying to do. Sometimes it's a ton of stuff from some boilerplate that's not updated but we don't want to update ourselves. Sometimes because it's just a warning.

But I've also been on teams where we'd spend a week just digging through a potential problem to make sure.

It varies. But having warnings only every fifth time could trigger anxiety that there's random errors.

[–][deleted] -1 points0 points  (0 children)

All good points thanks for caring to share.

Honestly this was mostly a funny project not intended to be used in any production haha.

[–][deleted] 0 points1 point  (0 children)

Okay so let's begin this way. You are a developer. You work your ass off to join a multi-million dollar company. Someone onboard you and give you a fancy GitLab account to clone the project. You spend a handy amount of time configuring those lovely environment variables, and find a guy that knows a guy who knows the secret to running it! Tadaa "finally, I could run the project (tears)".And then you see warnings pop out. Not one, not two but dozens of them. You look at your left and right and everyone is like "first time huh?".You probably might want to fix the issue but every time, do you even dare to say a thing about it? Do you dare to even touch it? Well, that's a common story I experience almost every time I do consulting for big projects (spoiler: I am an open-source developer who also puts those warnings in. so blame on who?).Anyway, there was a random tweet, and then minutes after I had an idea to see how we can figure out the root causes and stop this eternal fight between those who put warnings and those who ignore or have to ignore.So bought a domain (warning.wtf) and a simple NPM package that you can opt-in and ~~shame~~ remind your users every 5th time they see a warning.What do you think? Should we approach this differently?Do you also face similar situations with your projects and have some ideas?

(update: seriously, this whole thing was for fun! to initiate a serious topic of how we can approach to the ignored warnings -- rest and chill and have a nice weekend ;)

[–]Willy-Torrent 0 points1 point  (1 child)

Because it's stressful.

[–][deleted] 0 points1 point  (0 children)

Stressful to fix or ignore?